|
@@ -107,7 +107,7 @@ Manage.prototype.loadWeixin = function() {
|
|
|
|
|
|
Manage.prototype.loadAudio = function() { //相关:g_tourAudio \ g_playAudio
|
|
|
g_bgAudio = new Audio;
|
|
|
- g_bgAudio.loop = true;
|
|
|
+ //g_bgAudio.loop = true;
|
|
|
g_bgAudio.autoplay = true;
|
|
|
g_bgAudio.id = "bgaudio";
|
|
|
|
|
@@ -134,8 +134,12 @@ Manage.prototype.loadAudio = function() { //相关:g_tourAudio \ g_playAudio
|
|
|
document.addEventListener("touchstart", play);//ios需要加个事件才能播放 不能自动播放;如果还有浏览器不行,换成别的交互事件
|
|
|
document.addEventListener("click", play);
|
|
|
$('#player')[0].addEventListener("touchstart", play);
|
|
|
- g_bgAudio.addEventListener('ended', ()=>{
|
|
|
- this.switchBgmState(true)
|
|
|
+ g_bgAudio.addEventListener('ended', ()=>{
|
|
|
+ //间隔5s
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.bgmShouldPlay && this.switchBgmState(true)
|
|
|
+ },5000)
|
|
|
+
|
|
|
});
|
|
|
|
|
|
|
|
@@ -155,7 +159,7 @@ Manage.prototype.loadAudio = function() { //相关:g_tourAudio \ g_playAudio
|
|
|
|
|
|
|
|
|
}
|
|
|
-Manage.prototype.switchBgmState = function(state,fun){
|
|
|
+Manage.prototype.switchBgmState = function(state){
|
|
|
if(!g_bgAudio || !g_bgAudio.src) return;
|
|
|
this.bgmShouldPlay = state
|
|
|
|