Avoid stopping background audio for howler.js sprite playback on iOS

房东的猫 提交于 2019-12-11 03:02:42

问题


I'm making a little browser game as a study project, with howler.js 2.0 handling the sound effects.

When I play the game on iOS and I'm listening to music (say, in the music player app), the game sound effects will stop the background audio. Actually, I believe all background audio stops upon load of the game.

Is there any way to prevent this and keep the background audio going?

I'd prefer to avoid audio ducking as well, but could live with that if it's the only option.

The game is here: http://ashryanbeats.com/apps/guessing-game/index.html

Howler is invoked in this way:

var sound = new Howl({
  src: ['sounds/game-sounds.ogg', 'sounds/game-sounds.mp3'],
  sprite: {
    warmSound: [0, 750],
    coldSound: [875, 950],
    winSound: [1930, 2500],
    sameSound: [4518, 850],
    loseSound: [6093, 1700]
  }
});

howler.js 2.0 ref: https://github.com/goldfire/howler.js/tree/2.0

来源:https://stackoverflow.com/questions/27983463/avoid-stopping-background-audio-for-howler-js-sprite-playback-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!