0
我的網頁上有一個小小的問題,SWFObject
。行爲是,當Flash播放器被另一個標籤覆蓋或最小化時,它不會開始播放音頻,直到標籤再次獲得焦點並且可見。它使用來自http://code.google.com/p/swfobject/的SWFObject
的2.1版本。爲了驗證此行爲,請加載頁面,並在5秒內將其最小化,並且您會注意到beginPlay
中的代碼會更改頁面的標題。這種情況發生在音頻開始播放之後,但是直到瀏覽器重新獲得焦點後纔會開始播放。下面是代碼的樣本複製的問題:SWFObject音頻播放器在最小化時不播放
<html>
<head>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="audio-player-uncompressed.js"></script>
<script>
function doLoad() {
AudioPlayer.setup("player2.swf", {
width: "350px",
animation: "no",
autostart: "yes",
loop: "yes",
buffer: "5",
initialvolume: 100,
});
AudioPlayer.embed("flashPlayer");
}
function beginPlay(){
setTimeout(function(){
AudioPlayer.embed("flashPlayer", {
soundFile: "test.mp3"
});
document.title = "code after the flash player has executed."
}, 5000);
}
</script>
</head>
<body onload="doLoad();">
This demonstration is to show how either WP Audio Player or SWFObject
does not build the flash player while the browser is minimized.
<br><br>
<a href="javascript:beginPlay();">click this and minimize quickly.</a><br>
<div id="flashPlayer"></div>
</body>
</html>