-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
Description
Version
- Phaser Version: 3.53 or higher. 3.52 is ok.
- Operating system: iOS 14
- Browser: safari
Description
No sounds on iOS 14 safari after ver 3.53.
I found this commit 7cbf384 is making the issue.
SceneManager.loadComplete will no longer try to unlock the Sound Manager, preventing AudioContext was not allowed to start console warnings after each Scene finishes loading.
Example Test Code
// This is revert of https://github.com/photonstorm/phaser/commit/7cbf3840af296c2f1f510be15b39a2519f7a72cf
// If remove below, safari doesn't play sounds
Phaser.Scenes.SceneManager.prototype.loadComplete = function (loader) {
const scene = loader.scene
if (this.game.sound && this.game.sound.onBlurPausedSounds) {
this.game.sound.unlock()
}
this.create(scene)
}
const config = {
type: Phaser.AUTO,
width: 200,
height: 200,
audio: {
disableWebAudio: true // Another issue (?) https://stackoverflow.com/questions/63864590/no-sound-in-phaser-3-app-when-using-capacitor-to-build-for-ios
},
scene: {
preload () {
this.load.setBaseURL('https://libra.laineus.com')
this.load.audio('bgm', ['audio/bgm/happy.ogg', 'audio/bgm/happy.m4a'])
},
create () {
this.sound.add('bgm', { loop: true, volume: 1 }).play()
}
}
}
new Phaser.Game(config)