SWFObject
Web ページの に小さな問題があります。この動作は、Flash Player が別のタブに隠れているか最小化されている場合、タブが再びフォーカスされて表示されるまでオーディオの再生を開始しないというものです。http://code.google.com/p/swfobject/の 2.1 バージョンを使用していSWFObject
ます。この動作を確認するには、ページを読み込み、5 秒以内に最小化します。ページのタイトルが変更されたコードに気付くでしょう。これは、オーディオの再生が開始された後に発生しますが、ブラウザが再びフォーカスされるまで開始されません。問題を再現するコードのサンプルを次に示します。beginPlay
<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>