PBS-KIDS / Platypus

2D tile based game framework in HTML5
128 stars 30 forks source link

Mobile Audio Not Playing #16

Closed pleduc closed 10 years ago

pleduc commented 10 years ago

I'm having an issue getting audio to play on mobile devices. I tried running the mookie example provided to find differences in what I've implemented vs what's in the example, but audio for mobile doesn't appear to be working for the example either. Also, I began development of my project previous to the update that included the new version of create-js so that code isn't in my project. I think if I could identify what was acting up in the example, I could apply that solution to my own project. Thank you for your help, Patrick

probityrules commented 10 years ago

Hi Patrick,

Do you know when you pulled the engine to begin your project? There appear to be quite a few audio fixes over the past few months, so I want to make sure I'm looking at the same version you're on before testing the example out. Thanks!

pleduc commented 10 years ago

i just pulled down the most recent version of the example, but my project's codebase has been based upon a pull from around September or October of last year.

probityrules commented 10 years ago

Hi Patrick, I just double-checked the example and the audio appears to be working on the mobile devices I tested. What platform(s) are you seeing problems with audio?

pleduc commented 10 years ago

I'm testing on an original nexus 7 to nail down android before moving on to iOS. When I inspect the target using chrome's developer tools it says that my .ogg files are "canceled" in the network tab. Do you know what might be causing this or perhaps this is something that Monkey Mayhem also ran into? Also I've tested and this behavior happens whether the files are served locally or through the web.

Thanks for any help, Patrick

probityrules commented 10 years ago

There are definitely some odd audio behaviors across the spectrum of mobile devices. Our experience with mobile Chrome is that it cancels the audio stream (as you see) but the audio still plays successfully, without posting additional network information. Quite confusing. We're also finding that some Android devices require a user-initiated event to get audio started, similar to iOS. We haven't found a conclusive way to detect when this is a requirement, but we haven't needed a user-initiated event on our Nexus 7 Android 4.3 nor our Galaxy Tab 3 Android 4.1, but have needed a user-initiated event on a Galaxy Tab running Android 4.2. We're in the process of working on viable solutions to handle these varying behaviors.

Monkey Mayhem was QA tested using strictly HTML5 audio on slightly older devices running Android 2.3 I believe, so I've yet to check how the audio performs on mobile Chrome in the latest round of Android versions.