简体   繁体   中英

CloudStorageTools::serve() audio not playing on iOS

I'm using GoogleCloudStorage::serve() to serve .mp3 files via a website on Google App Engine with an HTML5 audio tag. Everything was working fine, but after an update for iOS , these devices were unable to play the audio in any browser.

I'm not sure why the code stopped working. Everything else still works fine on Android and Windows in all browsers.

It doesn't relay on Javascript or auto play at all. It's just a simple audio tag with the source being provided by GoogleCloudStorage::serve() , which works everywhere except recently on iOS.

Any input would be appreciated.

This is a shot in the dark because I don't know anything about serving audio files on iOS, but in case it helps...

About the same time you posted this question, a friend asked me to help him with his website. The website previously played audio, but around the time of your question, the audio stopped working on Safari on OS X.

The existing audio player that was being used was Flash based. I switched his website to playing audio using HTML5 and then it worked fine.

So you may want to check if you are playing audio in iOS with a Flash player and change it to HTML5 if you can.

Do you rely on autoplay ? iOS disables autoplay, you really have to let the user touch a button, or something.

Quote from Apple's documentation :

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.

This plays the movie: <input type="button" value="Play" onclick="document.myMovie.play()">

This does nothing on iOS : <body onload="document.myMovie.play()">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM