我不确定为什么我的网站会崩溃,但出于某种原因,我每次执行搜索并返回html5音频结果时都会崩溃。
用户搜索我们的数据库并传送音乐。我无法在FF中崩溃,但在Chrome和Safari中崩溃。
$('.audioplayerHTML5').live('click', function(event) {
var audio = '';
var playbutton = '';
var video = $('.videoplayer').get(0);
var $syncMusic = $('#syncMusic');
var $last_played = $('#last_played');
var $playAudioBeginning = $('#playAudioBeginning');
var $playFromBeginning = $('#playFromBeginning');
var $sliderVideo = $('#sliderVideo');
if ($.browser.mozilla) {
playbutton = event.layerX < 31;
} else if ($.browser.safari) {
playbutton = event.offsetX < 61;
} else if ($.browser.webkit) {
playbutton = event.offsetX < 31;
}
if (!playbutton) return;
if (!this.paused) {
pause(this, $syncMusic.is(':checked') ? video : null);
} else if (this.paused) {
//this.play();
if (!$last_played.val()) {
$last_played.val(this.id);
if ($syncMusic.is(':checked') && video) {
if ($playFromBeginning.is(':checked') && !video.paused) {
video.currentTime = document.getElementById("offsetVideo").value;
} else {
video.play();
}
}
if ($playAudioBeginning.is(':checked')) {
this.currentTime = 0;
}
this.play();
} else if ($last_played.val() !== this.id) {
audio = $('#' + $last_played.val()).get(0);
if (!audio) {
$last_played.val(this.id);
if ($syncMusic.is(':checked') && video) {
if ($playFromBeginning.is(':checked') && !video.paused) {
video.currentTime = document.getElementById("offsetVideo").value;
} else {
video.play();
}
}
if ($playAudioBeginning.is(':checked')) {
this.currentTime = 0;
}
this.play();
} else {
audio.pause();
$last_played.val(this.id);
if ($syncMusic.is(':checked') && video) {
if ($playFromBeginning.is(':checked') && !video.paused) {
video.currentTime = document.getElementById("offsetVideo").value;
} else {
video.play();
}
}
if ($playAudioBeginning.is(':checked')) {
this.currentTime = 0;
}
this.play();
}
} else if ($last_played.val() == this.id) {
if ($syncMusic.is(':checked') && video) {
if ($playFromBeginning.is(':checked') && !video.paused) {
video.currentTime = document.getElementById("offsetVideo").value;
} else {
video.play();
}
}
if ($playAudioBeginning.is(':checked')) {
this.currentTime = 0;
}
this.play();
}
}
});
参考: jQuery .live and WebKit are crashing http://code.google.com/p/chromium/issues/detail?id=79685
答案 0 :(得分:0)
如果浏览器支持,你会检查浏览器并输出ogg或mp3吗? 认为一个插件崩溃浏览器?
答案 1 :(得分:0)