audio system respect mute before play
parent
fb4a86c016
commit
12077d7a9a
|
@ -142,6 +142,18 @@ GameLib.System.Audio.prototype.playAudio = function(data) {
|
|||
console.log('audio not ready yet');
|
||||
}
|
||||
|
||||
if (this.mute && typeof audio.backupVolume === 'undefined') {
|
||||
audio.backupVolume = audio.volume;
|
||||
audio.volume = 0;
|
||||
audio.updateInstance('volume');
|
||||
}
|
||||
|
||||
if (!this.mute && typeof audio.backupVolume === 'number') {
|
||||
audio.volume = audio.backupVolume;
|
||||
delete audio.backupVolume;
|
||||
audio.updateInstance('volume');
|
||||
}
|
||||
|
||||
if (audio.overplay) {
|
||||
if (audio.instance.isPlaying) {
|
||||
audio.instance.stop();
|
||||
|
@ -152,7 +164,7 @@ GameLib.System.Audio.prototype.playAudio = function(data) {
|
|||
audio.instance.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
if (!found) {
|
||||
|
@ -187,7 +199,13 @@ GameLib.System.Audio.prototype.continueAllAudio = function(data) {
|
|||
function(audio) {
|
||||
// audio.instance.context.currentTime = audio.currentTime;
|
||||
audio.paused = false;
|
||||
audio.updateInstance('paused');
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.PLAY_AUDIO,
|
||||
{
|
||||
name : audio.name
|
||||
}
|
||||
);
|
||||
// audio.updateInstance('paused');
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue