jwplayer设置全屏模式onclick

时间:2014-06-01 01:49:03

标签: jquery jwplayer jwplayer6

为什么这段代码不适合我? 我希望点击播放器以全屏模式设置播放器...

jwplayer('player').setup({
    file: 'file.mp4',
    image: 'poster.jpg',
    width: '600px',
    aspectratio: '4:3'
});
$(document).ready(function() {
    $('#player').click(function() {
        jwplayer('player').setFullscreen(true);
    }); 
});

2 个答案:

答案 0 :(得分:2)

从JW Player API参考引用:

  

请注意,由于与网络钓鱼相关,因此没有API调用来设置全屏   Flash和HTML5中的安全限制。

答案 1 :(得分:0)

这只适用于HTML5模式:

<!DOCTYPE html>
<html>
<head>
    <title>Full Screen</title>
</head>
<body>
    <script src="http://p.jwpcdn.com/6/12/jwplayer.js" type="text/javascript"></script>
    <div id="player"></div>
    <script type="text/javascript" language="javascript">
    jwplayer("player").setup({
        file: "http://content.jwplatform.com/videos/C4lp6Dtd-el5vTWpr.mp4",
        image: "http://content.bitsontherun.com/thumbs/i8oQD9zd-640.jpg",
        primary: 'html5',
        width: 640,
        height: 360
    });
    jwplayer().onDisplayClick(function() { jwplayer().setFullscreen(true); });
    </script>
</body>
</html>

链接:https://stackoverflow.com/a/28950999/1877909

如果您使用angular,则可以使用仅适用于html5的angularFullScreen