Jplayer播放列表全屏无效

时间:2014-01-20 08:27:23

标签: javascript jquery jplayer

我尝试将JPlayer播放列表中的视频炸成全屏(全尺寸)。但尺寸始终保持不变。

来源:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Test Playlist</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="jplayerd/js/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="jplayerd/js/jplayer.playlist.min.js"></script>

<script type="text/javascript">
    $(document).ready(function() {
        var cssSelector = { 
            jPlayer: "#jquery_jplayer_1", 
            cssSelectorAncestor: "#jp_container_1" 
        };

        $("#jquery_jplayer_1").jPlayer("option", {"fullScreen": true});

        var playlist = [
            {
                title:"Big Buck Bunny Trailer",
                artist:"Blender Foundation",
                m4v:"http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v"
            }
        ];

        var options = {
            playlistOptions: {
                autoPlay: true,
                enableRemoveControls: true
            },
            sizeFull: {
                width: this.windowWidth,
                height: this.windowHeight
            },               
            swfPath: "jplayerd/js", 
            supplied: "m4v",
            fullScreen: true
        };

        var myPlaylist = new jPlayerPlaylist(cssSelector, playlist, options);
    });     
</script>
</head>
<body>
<div id="jp_container_1" class="jp-video jp-video-full">
    <div class="jp-type-playlist">
        <div id="jquery_jplayer_1" class="jp-jplayer" style="width: 100%; height: 100%;"></div>
    </div>

    <div class="jp-playlist" style="display:none;">
        <ul>
            <!-- The method Playlist.displayPlaylist() uses this unordered list -->
            <li></li>
        </ul>
    </div>

    <div class="jp-no-solution">
        <span>Unable to play your Video</span>
    </div>
</div>  
</body>
</html>

在HTML中,我看到元素上有一种始终保持不变的样式。 480px x 270px。我尝试添加一个不同大小的样式,但它似乎总是被覆盖。

<div id="jp_container_1" class="jp-video jp-video-full jp-video-270p">
    <div class="jp-type-playlist">
        <div id="jquery_jplayer_1" class="jp-jplayer" style="width: 480px; height: 270px;">
            <img id="jp_poster_0" style="width: 480px; height: 270px; display: none;">
                <object id="jp_flash_0" width="1" height="1" name="jp_flash_0" data="jplayerd/js/Jplayer.swf"   type="application/x-shockwave-flash" tabindex="-1" style="width: 480px; height: 270px;">
        </div> 
   </div>

如果我只使用没有播放列表的Jplayer,则代码正常工作:

<html>
<head>
<meta charset=utf-8 />

<!-- Website Design By: www.happyworm.com -->
<title>Demo : jPlayer as a video player</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="jplayerd/skin/blue.monday/jplayer.blue.monday.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">    </script>
<script type="text/javascript" src="jplayerd/js/jquery.jplayer.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){

$("#jquery_jplayer_1").jPlayer({
    ready: function () {
        $(this).jPlayer("setMedia", {
            m4v: "http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v",
            poster: "http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png"
        })
        .jPlayer("option", {"fullScreen": true})
        .jPlayer("play");
    },
    swfPath: "jplayerd/js",
    supplied: "m4v",
    size: {
        width: "640px",
        height: "360px",
        cssClass: "jp-video-360p"
    },
sizeFull: {
    width: this.windowWidth,
    height: this.windowHeight
},
    smoothPlayBar: true,
    keyEnabled: true
});
});
//]]>
</script>
</head>
<body>
    <div id="jp_container_1" class="jp-video jp-video-360">
        <div class="jp-type-single">
            <div id="jquery_jplayer_1" class="jp-jplayer"></div>
            <div class="jp-gui">
                <div class="jp-video-play">
                    <a href="javascript:;" class="jp-video-play-icon" tabindex="1">play</a>
                </div>
                <div class="jp-interface">
                    <div class="jp-progress">
                        <div class="jp-seek-bar">
                            <div class="jp-play-bar"></div>
                        </div>
                    </div>
            </div>
            <div class="jp-no-solution">
                <span>Update Required</span>
                To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
            </div>
        </div>
    </div>
</body>
</html>

似乎没有正确解析播放器中的fullScreen选项。有人可以告诉我如何使用播放列表插件吗?

我正在使用JPlayer 2.5.0。

1 个答案:

答案 0 :(得分:0)

从选项变量中删除全屏行:true

新代码

       var options = {
        playlistOptions: {
            autoPlay: true,
            enableRemoveControls: true
        },
        sizeFull: {
            width: this.windowWidth,
            height: this.windowHeight
        },               
        swfPath: "jplayerd/js", 
        supplied: "m4v"

    };

Working Demo

请参阅here了解更多jplayer播放列表