gpt4 book ai didi

jquery - Jplayer Ready功能不触发flash的解决办法

转载 作者:行者123 更新时间:2023-12-01 03:14:10 25 4
gpt4 key购买 nike

我正在使用 Jplayer(2.2.0 和 jquery 1.6)在我的应用程序中播放音频文件。音频必须使用 flash 解决方案。但是,当解决方案选项设置为 flash 时,不会触发就绪功能,因此当我播放文件时会出现错误。

当谷歌搜索此问题时,推荐的解决方案是检查 .swf 文件的路径。路径是正确的。这是通过 Newtwork 选项卡(chrome 开发工具)进行双重检查的。在网络选项卡中,.swf 文件已下载,没有任何错误。

<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){

jQuery("#jquery_jplayer_1").jPlayer({
ready: function () {
jQuery(this).jPlayer("setMedia", {
mp3: "http://www.happyworm.com/audio/mp3/Miaow-07-Bubble.mp3"
}).jPlayer("play",40);
},
swfPath:"js/",
ended: function (event){
jQuery(this).jPlayer("play",20);
},
supplied:"mp3",
solution:"flash,html",
volume: .50,
wmode:"window"
//preload: 'auto'
});


jQuery("#jquery_jplayer_N").bind(jQuery.jPlayer.event.error, function (event) {
switch (event.jPlayer.error.type) {
case jQuery.jPlayer.error.URL:
console.log("error file");
break;
case jQuery.jPlayer.error.NO_SOLUTION:
// Do something
console.log("NO_SOLUTION");
break;
}
console.log(event.jPlayer.error.type);
});
});

<body>

<div id="jquery_jplayer_1" class="jp-jplayer"></div>

<div id="jp_container_1" class="jp-audio">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<ul class="jp-controls">
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
</ul>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
<div class="jp-time-holder">
<div class="jp-current-time"></div>
<div class="jp-duration"></div>

<ul class="jp-toggles">
<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>
</ul>
</div>
</div>
<div class="jp-title">
<ul>
<li>Cro Magnon Man</li>
</ul>
</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>

最佳答案

检查你的风格。如果您的#jquery_jplayer_1或其父级具有display=none,则在opera或firefox等浏览器中永远不会触发ready事件。我的意思是 Flash 对象无法隐藏。

关于jquery - Jplayer Ready功能不触发flash的解决办法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19339810/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com