简体   繁体   English

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

[英]Open mp4 video with JPlayer in Opera/Firefox

To play MP4 video i use the following script: 要播放MP4视频,请使用以下脚本:

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

The player is initialized with following code: 播放器使用以下代码初始化:

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

If i open the video in Chrome/IE- everything works fine. 如果我在Chrome / IE中打开视频,则一切正常。 But in Opera/Firefox flash is loading(flash embedded code appears on the page), but video is not and nothing plays. 但是在Opera / Firefox中,Flash正在加载(Flash嵌入式代码显示在页面上),但视频未加载,并且没有播放。 Here is the code that is loading in jplayer div in 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>

Can you suggest what to try? 您能建议尝试什么吗? Cant figure out what can cause such problem if the path to flash player is correct. 不能弄清楚如果Flash Player的路径正确,是什么会导致这种问题。

My problem was that flash had no time to initialize and set media. 我的问题是闪存没有时间初始化和设置媒体。 Adding setMedia to player initalization into ready event helped. 添加setMedia到玩家initalization为ready事件的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM