mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 08:11:54 +08:00
fix audio context resuming for browsers with no autoplay policy
This commit is contained in:
+11
-5
@@ -220,6 +220,7 @@
|
||||
Events.init();
|
||||
Room.init();
|
||||
|
||||
|
||||
if(typeof $SM.get('stores.wood') != 'undefined') {
|
||||
Outside.init();
|
||||
}
|
||||
@@ -230,10 +231,6 @@
|
||||
Ship.init();
|
||||
}
|
||||
|
||||
if(!$SM.get('config.soundOn')){
|
||||
Engine.toggleVolume();
|
||||
}
|
||||
|
||||
if($SM.get('config.lightsOff', true)){
|
||||
Engine.turnLightsOff();
|
||||
}
|
||||
@@ -242,11 +239,20 @@
|
||||
Engine.triggerHyperMode();
|
||||
}
|
||||
|
||||
if(!AudioEngine.isAudioContextRunning()){
|
||||
Engine.toggleVolume();
|
||||
document.addEventListener('click', Engine.resumeAudioContext);
|
||||
}
|
||||
|
||||
Engine.saveLanguage();
|
||||
Engine.travelTo(Room);
|
||||
|
||||
},
|
||||
|
||||
resumeAudioContext: function () {
|
||||
AudioEngine.tryResumingAudioContext();
|
||||
Engine.toggleVolume();
|
||||
document.removeEventListener('click', Engine.resumeAudioContext);
|
||||
},
|
||||
browserValid: function() {
|
||||
return ( location.search.indexOf( 'ignorebrowser=true' ) >= 0 || ( typeof Storage != 'undefined' && !oldIE ) );
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user