Timeline audio errors in iOS 11 app


(Dan Wright) #1

Hi all,
I have a fully functioning multi-scene app which has some audio issues.

I’ve taken the HTML5 output file and resource folder directly into Xcode and used Swift to build an iOS app successfully but it throws up errors when an audio file is triggered in the timeline (unless on the first frame) and the audio is not triggered. I have automatically playing timelines when a scene is loaded and also user triggered button timelines, both have the same problem and throw up the same error:

“[Error] Unhandled Promise Rejection: NotAllowedError (DOM Exception 35): The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
(anonymous function)
rejectPromise
play
play (HYPE-584.thin.min.js:82:138)
kk (HYPE-584.thin.min.js:63)
(anonymous function) (HYPE-584.thin.min.js:14:249)
Ob (HYPE-584.thin.min.js:32)
zg (HYPE-584.thin.min.js:32:305)
(anonymous function) (HYPE-584.thin.min.js:36:450)”

The weird thing is that if you first trigger an audio file that is attached directly to a button, it sounds, it can then be triggered in a timeline, so it’s as if the app has to wait until a sound file is played before it can then be triggered in any timeline event, as if timeline events won’t load the audio.

If anyone has any ideas then it would be great to hear them.

Also, if one audio file is triggered quickly after a first, the front of it is cut off, so the ‘attack’ is lost, I guess this is something down to overlapping, more annoying than serious.

Thanks in advance

Dan


#2

Hi Dan @Backbone

A little late with a reply. With iOS, in the majority of cases, audio must be requested by the user (permission) as autoplay is not accepted. This is probably the experience you are having as the mention the sound is triggered by a button and then it works as expected.

You could probably add a button that asks the user if they want sound effects and this can trigger the sounds (with or without volume) and therefore allowing them to be triggered elsewhere. If this fits in with the aesthetics.


(Dan Wright) #3

Hi DBear,

thanks for the reply, that’s a good point, I’ll look into that with the ‘Play timeline’ buttons, although why would it work if the audio file is triggered as a timeline event from a Scene load if it’s on the first frame but not if it’s on the second or beyond frames in the loading Scene? I’m not up on the ‘laws’ of iOS and the audio issues involved other than suffering at the hands of them!

Thanks again

Dan