在Opera / Firefox中使用JPlayer打开mp4视频

时间:2013-01-08 10:23:54

标签: javascript jquery video mp4 jplayer

要播放MP4视频,请使用以下脚本:

   $("#jplayer").jPlayer("setMedia", {
        m4v: "./videos/test.mp4"
    }).jPlayer("play", 0);

使用以下代码初始化播放器:

$("#jplayer").jPlayer({
        swfPath: "./jplayer/",
        supplied: "m4v",
        solutions: "flash, html",
        size: {
            width: "640px",
            height: "460px"
        },
        nativeVideoControls: {
            all: /./
        },
    });

如果我在Chrome / IE中打开视频 - 一切正常。但是在Opera / Firefox中正在加载闪存(页面上出现了闪存嵌入代码),但是视频没有播放。这是在Opera / Firefox

中的jplayer div中加载的代码
<div id="jplayer" class="jp-jplayer" style="width: 640px; height: 460px; display: block;">
<img id="jp_poster_1" style="width: 640px; height: 460px; display: none;">
<object id="jp_flash_1" width="1" height="1" data="./jplayer/Jplayer.swf" type="application/x-shockwave-flash" style="width: 0px; height: 0px;">
<param name="flashvars" value="jQuery=jQuery&id=jplayer&vol=0.8&muted=false">
<param name="allowscriptaccess" value="always">
<param name="bgcolor" value="#000000">
<param name="wmode" value="opaque">
</object>
</div>

你能建议尝试一下吗?如果flash播放器的路径正确,可能无法找出导致此类问题的原因。

1 个答案:

答案 0 :(得分:0)

我的问题是flash没有时间初始化和设置媒体。将setMedia添加到玩家初始化为ready事件有帮助。

相关问题