我在使用Firefox 8中的jQuery Jplayer播放MP3文件时遇到问题。 我已经为我的浏览器安装了最新的闪存,我可以看到在Firebug的Flash选项卡中正在下载jplayer.swf文件。
我按此顺序包含以下文件:
<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>
答案 0 :(得分:14)
有几件事:
#jp_container_1
的DOM元素,而您未在HTML中提供以下是修补程序的小提琴:http://jsfiddle.net/75lb/gdLnT/
更正后的HTML:
<div id="jquery_jplayer"></div>
<div id="jp_container_1" 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>
更正后的Javascript:
$("#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/",
swfPath: "http://www.jplayer.org/latest/js/Jplayer.swf",
supplied: "mp3",
volume: 1,
wmode:"window",
solution: "html,flash",
});
答案 1 :(得分:2)
我遇到了同样的问题,我制作了一个jplayer音频播放列表并加载了mp3文件。
它正在使用chrome而不是firefox
我通过添加解决方案来解决这个问题:flash
$(document).ready(function(){
var myPlaylist = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
}, [
{
title:"Cro Magnon Man",
artist:"miaow",
mp3:"http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",
oga:"http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg"
}
], {
playlistOptions: {
enableRemoveControls: true
},
swfPath: "js",
supplied: "mp3",
wmode: "window",
solution: "flash",
});
$("#jplayer_inspector_1").jPlayerInspector({jPlayer:$("#jquery_jplayer_1")});