|
@@ -115,9 +115,10 @@ Manage.prototype.loadAudio = function() { //相关:g_tourAudio \ g_playAudio
|
|
|
g_bgAudio.load(); // iOS 9 还需要额外的 load 一下, 否则直接 play 无效
|
|
|
var play = function(){
|
|
|
//if(window.tourAudioSta) return;
|
|
|
+ if(this.bgmShouldPlay){
|
|
|
+ this.switchBgmState(true)
|
|
|
+ }
|
|
|
|
|
|
- this.switchBgmState(true)
|
|
|
-
|
|
|
document.removeEventListener("touchstart",play);
|
|
|
document.removeEventListener("click",play);
|
|
|
$('#player')[0].removeEventListener("touchstart", play);
|
|
@@ -156,8 +157,9 @@ Manage.prototype.loadAudio = function() { //相关:g_tourAudio \ g_playAudio
|
|
|
}
|
|
|
Manage.prototype.switchBgmState = function(state,fun){
|
|
|
if(!g_bgAudio || !g_bgAudio.src) return;
|
|
|
+ this.bgmShouldPlay = state
|
|
|
|
|
|
- var played = function(){
|
|
|
+ var played = function(){
|
|
|
console.log('begin play bgm '+ g_bgAudio.src);
|
|
|
g_play = 1;
|
|
|
g_playAudio = g_bgAudio;
|
|
@@ -173,7 +175,7 @@ Manage.prototype.switchBgmState = function(state,fun){
|
|
|
$("#volume").attr("title", "打开声音");
|
|
|
}
|
|
|
|
|
|
- if(state ){
|
|
|
+ if(state ){
|
|
|
g_bgAudio.play();
|
|
|
if(g_bgAudio.paused){
|
|
|
paused()
|