仅在Chrome中调试jPlayer初始化,在控制台中没有看到网络或js错误
Debugging jPlayer Initialization in Chrome only, no network or js errors seen in console
这个流媒体MP3播放器已经正常工作了8个月了。在过去的几周里,它已经发展出一种奇怪的行为,但只在Chrome中-在网站上任何地方的任何"听"链接的第一次点击产生预期的控制台输出和改变播放器区域的HTML,但流不开始。在控制台看不到网络404,403等。控制台没有抛出任何JS错误,除了Flash回退投诉,尽管文件在寻找的地方被找到,但总是抛出…
在IE、FF或Windows Safari中未发现此问题。
Live site: http://itsneworleans.com/
示例链接:
<a href="#top" ajax-data="/audio/episodes/2014_03_21_587_hello-swelo.mp3" ajax-data-id="587" ajax-data-alt="Happy Hour: Hello Swelo" class="playerLink ">Listen</a>
jPlayer init第233行http://itsneworleans.com/js/main.js
$("#jquery_jplayer_1").jPlayer({
supplied: "mp3",
swfPath: "http://itsneworleans.com/js/jQuery.jPlayer.2.5.0",
solution: "html,flash",
wmode:"transparent",
errorAlerts: true,
ended: function () {
console.log('ended event fired');
$.getScript('/js/random_show.js.php');
}
});
从http://itsneworleans.com/js/main.js点击函数245行:
$("body").on('click', '.playerLink', function() {
if ($(this).attr('ajax-data')) {
console.log("Playing " + $(this).attr('ajax-data'));
ga('send', 'pageview', {'page': $(this).attr('ajax-data'),'title': document.title});
console.log("Sending to GA " + $(this).attr('ajax-data'));
$("#jquery_jplayer_1").jPlayer("setMedia", {
mp3: $(this).attr('ajax-data')
}).jPlayer("play");
var chunks = $(this).attr('ajax-data-alt').split(':');
var title = chunks[0] + ':<br>' + chunks[1];
$('#playerTitle').html(title);
$('#poplink').attr('ajax-data', $(this).attr('ajax-data-id'));
var playtime = $("#jquery_jplayer_1").data("jPlayer").status.currentTime;
$.ajax({
type: "POST",
url: "/inc/pcnter.php",
data: {e:$(this).attr('ajax-data-id'), t:playtime, p:0}
});
if ($('#player').css('display') != 'block') {
$('#player').css('display', 'block');
$('#player').animate({"height":"80px"}, 1000);
}
}
});
输出:Playing /audio/episodes/2014_03_21_587_hello-swelo.mp3 main.js:247
Sending to GA /audio/episodes/2014_03_21_587_hello-swelo.mp3 main.js:250
jPlayer 2.5.0 : id='jquery_jplayer_1' : Error!
jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: undefined is not a function
Check your swfPath option and that Jplayer.swf is there.
Context: http://itsneworleans.com/js/jQuery.jPlayer.2.5.0/Jplayer.swf
我添加了一个带有控制台输出的ready()函数。我发现它只在第二次点击Listen链接时触发。
根据这个结果进行了更多的搜索后,我发现了这篇文章:
"检查你的样式。如果您的#jquery_jplayer_1或它的父级具有Display =none, ready事件在opera或firefox。我是说闪光对象是无法隐藏的。"
我不能说为什么它以前工作过,但发生的事情是,jPlayer的Flash解决方案无法加载,因为我的播放器显示设置为none。
所以现在我通过一个负的margin-top偏移了玩家,而不是动画高度,而是动画margin-top。
相关文章:
- 在fabric.js中以PNG格式下载Canvas,给出网络错误
- 如何在使用XMLHttpRequest时向用户显示实际的网络错误
- getJSON:网络错误:500 内部服务器错误
- socket.io+express网络错误:404
- xmlhttprequest:网络错误0x800c0019,访问此资源所需的安全证书无效.WINJS
- 如何解决“网络错误:404未找到 - http://localhost:50765/Scripts/jquery-1.5
- 是否有一种全局方法来捕获 javascript 中的网络错误
- 幻影 - 处理网络错误
- 条纹付款问题 - 网络错误,您尚未被扣款
- 识别 Javascript 中的网络错误
- IE11 HTTPS AJAX XMLHttpRequest:网络错误0x2eff,由于错误00002eff而无法完成操
- xmlhttprequest网络错误,可能是js/jQuery超时
- 从XMLHttpRequest send()捕获异步网络错误
- 在网络错误时中止javascript加载
- Javascript网络错误为字符串
- Angular将文件保存为csv会导致失败-只有在Chrome上才会出现网络错误
- ajax调用返回网络错误;404.
- 捕捉HTML5媒体网络错误javascript
- 这个脚本是返回网络错误的原因
- Phonegap抛出“网络错误”;立即在手机上的PHP脚本的第一个字符-在Chrome/Dreamweaver中工作良好