为什么 jPlayer 无法在 Firefox 中播放我的 MP3 文件?
我在 Firefox 8 中使用 jQuery Jplayer 播放 MP3 文件时遇到问题。 我已经为我的浏览器安装了最新的 Flash,并且我可以看到 jplayer.swf 文件正在 Firebug 的 Flash 选项卡中下载。
我按此顺序包含以下文件:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script src="https://raw.github.com/happyworm/jPlayer/master/jquery.jplayer/jquery.jplayer.js" type="text/javascript" charset="utf-8"></script>
我在加载的 DOM 中包含此文件:
$("#jquery_jplayer").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
mp3: "http://sound26.mp3pk.com/indian/ladiesvsricky/ladiesvsrickybahl01(www.songs.pk).mp3"
});
},
swfPath: "http://cloudfactory-transcription.s3.amazonaws.com/javascripts/",
supplied: "mp3",
volume: 1,
wmode:"window",
solution: "html,flash"
});
我有此 HTML:
<div id="jquery_jplayer" style="height: 0px"></div>
<div class="jp-audio">
<div class="jp-type-single">
<div id="jp_interface_1" class="jp-interface all_rounded_corners">
<ul class="jp-controls">
<li><a href="#" class="jp-play pp" tabindex="1">play</a></li>
<li><a href="#" class="jp-pause pp" tabindex="1">pause</a></li>
<li><a href="#" class="jp-previous traverse" tabindex="1">Previous</a></li>
</ul>
<div class="jp-progress" style = "display:none;">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
</div>
</div>
</div>
Firefox 无法播放 MP3 文件。我还可以看到一个隐藏的对象,如下所示:
<object width="1" height="1" id="jp_flash_0" data="http://cloudfactory-transcription.s3.amazonaws.com/javascripts/Jplayer.swf" type="application/x-shockwave-flash"> <param name="flashvars" value="jQuery=jQuery&id=jquery_jplayer&vol=1&muted=false">
<param name="allowscriptaccess" value="always">
<param name="bgcolor" value="#000000">
<param name="wmode" value="window">
</object>
I am having trouble playing an MP3 file using jQuery Jplayer in Firefox 8.
I have installed the latest flash for my browser and I can see that the jplayer.swf file is being downloaded in the Flash tab of Firebug.
I included the following files in this order:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script src="https://raw.github.com/happyworm/jPlayer/master/jquery.jplayer/jquery.jplayer.js" type="text/javascript" charset="utf-8"></script>
And I have this in the DOM that loads:
$("#jquery_jplayer").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
mp3: "http://sound26.mp3pk.com/indian/ladiesvsricky/ladiesvsrickybahl01(www.songs.pk).mp3"
});
},
swfPath: "http://cloudfactory-transcription.s3.amazonaws.com/javascripts/",
supplied: "mp3",
volume: 1,
wmode:"window",
solution: "html,flash"
});
I have this HTML:
<div id="jquery_jplayer" style="height: 0px"></div>
<div class="jp-audio">
<div class="jp-type-single">
<div id="jp_interface_1" class="jp-interface all_rounded_corners">
<ul class="jp-controls">
<li><a href="#" class="jp-play pp" tabindex="1">play</a></li>
<li><a href="#" class="jp-pause pp" tabindex="1">pause</a></li>
<li><a href="#" class="jp-previous traverse" tabindex="1">Previous</a></li>
</ul>
<div class="jp-progress" style = "display:none;">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
</div>
</div>
</div>
And Firefox is not able to play the MP3 file. I can also see a hidden object which looks like this:
<object width="1" height="1" id="jp_flash_0" data="http://cloudfactory-transcription.s3.amazonaws.com/javascripts/Jplayer.swf" type="application/x-shockwave-flash"> <param name="flashvars" value="jQuery=jQuery&id=jquery_jplayer&vol=1&muted=false">
<param name="allowscriptaccess" value="always">
<param name="bgcolor" value="#000000">
<param name="wmode" value="window">
</object>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有几件事:
#jp_container_1
的 DOM 元素,您没有在 HTML 中提供该元素,这是一个修复的小提琴: http://jsfiddle.net/75lb/gdLnT/
更正后的HTML:
更正后的 Javascript:
there were a couple of things:
#jp_container_1
, which you did not supply in your HTMLHere is a Fiddle with the Fix: http://jsfiddle.net/75lb/gdLnT/
The corrected HTML:
The corrected Javascript:
我遇到了同样的问题,我制作了一个 jplayer 音频播放列表并在其中加载了 mp3 文件。
它在 Chrome 上工作,而不是在 Firefox 上工作,
我通过添加解决方案解决了这个问题:flash
i had the same problem i made a jplayer audio playlist and loaded mp3 files in it.
it was working on chrome not on firefox
i fixed that by adding solution :flash