fps-three.js icon indicating copy to clipboard operation
fps-three.js copied to clipboard

Sounds do not play in iOS

Open makc opened this issue 11 years ago • 1 comments

Apple says:

In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and autoplay are disabled. No data is loaded until the user initiates it. This means the JavaScript play() and load() methods are also inactive until the user initiates playback, unless the play() or load() method is triggered by user action. In other words, a user-initiated Play button works, but an onLoad="play()" event does not.

What would be the workaround? Shotgun sounds and footsteps could potentially be initiated from touch events, but the rest... no idea so far.

makc avatar Oct 18 '14 17:10 makc

Okay, these guys do this:

The default behavior of howler.js is to attempt to silently unlock audio playback by playing an empty buffer on the first touchstart event.

[code]

makc avatar Feb 02 '15 00:02 makc