我需要在音乐开始后使用睡眠8秒并使用自动启动/自动播放完成,此时音乐在完成时加载,无需等待8秒。
以下代码无效:
<audio controls="controls" onloadeddata="var audioPlayer = this; setTimeout(function() { audioPlayer.play(); }, 8000)">
但目标是睡眠8秒,然后再重新启动背景音乐。
$rand_no=mt_rand (10000,1000000);
$content='<p><script>
jQuery(function() {
jQuery("#lbg_audio1_html5_'.$row["id"].$rand_no.'").audio1_html5({
skin:"'.$row["skin"].'",
initialVolume:'.$row["initialVolume"].',
autoPlay:'.$row["autoPlay"].',
loop:'.$row["loop"].',
shuffle:'.$row["shuffle"].',
continuouslyPlayOnAllPages:'.$row["continuouslyPlayOnAllPages"].',
playerPadding:'.$row["playerPadding"].',
playerBg:"#'.$row["playerBg"].'",
bufferEmptyColor:"#'.$row["bufferEmptyColor"].'",
bufferFullColor:"#'.$row["bufferFullColor"].'",
seekbarColor:"#'.$row["seekbarColor"].'",
volumeOffColor:"#'.$row["volumeOffColor"].'",
volumeOnColor:"#'.$row["volumeOnColor"].'",
timerColor:"#'.$row["timerColor"].'",
songAuthorTitleColor:"#'.$row["songAuthorTitleColor"].'",
showRewindBut:'.$row["showRewindBut"].',
showPlayBut:'.$row["showPlayBut"].',
showPreviousBut:'.$row["showPreviousBut"].',
showNextBut:'.$row["showNextBut"].',
showPlaylistBut:'.$row["showPlaylistBut"].',
showVolumeBut:'.$row["showVolumeBut"].',
showVolumeSliderBut:'.$row["showVolumeSliderBut"].',
showTimer:'.$row["showTimer"].',
showSeekBar:'.$row["showSeekBar"].',
showAuthor:'.$row["showAuthor"].',
showTitle:'.$row["showTitle"].',
showPlaylist:'.$row["showPlaylist"].',
showPlaylistOnInit:'.$row["showPlaylistOnInit"].',
playlistTopPos:'.$row["playlistTopPos"].',
playlistBgColor:"#'.$row["playlistBgColor"].'",
playlistRecordBgOffColor:"#'.$row["playlistRecordBgOffColor"].'",
playlistRecordBgOnColor:"#'.$row["playlistRecordBgOnColor"].'",
playlistRecordBottomBorderOffColor:"#'.$row["playlistRecordBottomBorderOffColor"].'",
playlistRecordBottomBorderOnColor:"#'.$row["playlistRecordBottomBorderOnColor"].'",
playlistRecordTextOffColor:"#'.$row["playlistRecordTextOffColor"].'",
playlistRecordTextOnColor:"#'.$row["playlistRecordTextOnColor"].'",
numberOfThumbsPerScreen:'.$row["numberOfThumbsPerScreen"].',
playlistPadding:'.$row["playlistPadding"].',
showPlaylistNumber:'.$row["showPlaylistNumber"].',
isSliderInitialized:'.$row["isSliderInitialized"].',
isProgressInitialized:'.$row["isProgressInitialized"].'
});
});
</script>
'.$new_div_start.'<div class="audio1_html5">
<audio id="lbg_audio1_html5_'.$row["id"].$rand_no.'" preload="'.$preload_aux.'">
<div class="xaudioplaylist">'.$playlist_str.'</div>
<audio controls="controls" onloadeddata="var audioPlayer = this; setTimeout(function() { audioPlayer.play(); }, 8000)">
No HTML5 audio playback capabilities for this browser. Use <a href="https://www.google.com/intl/en/chrome/browser/">Chrome Browser!</a>
</audio>
</div>
<br style="clear:both;">'.$new_div_end.'</p>';
return str_replace("\r\n", '', $content);
}