简体   繁体   English

CloudStorageTools :: serve()音频无法在iOS上播放

[英]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. 我正在使用GoogleCloudStorage::serve()通过带有HTML5 audio标签的Google App Engine网站通过.mp3文件提供服务。 Everything was working fine, but after an update for iOS , these devices were unable to play the audio in any browser. 一切工作正常,但在iOS更新后,这些设备无法在任何浏览器中播放音频。

I'm not sure why the code stopped working. 我不确定代码为什么停止工作。 Everything else still works fine on Android and Windows in all browsers. 其他所有内容在所有浏览器上的Android和Windows上仍然可以正常运行。

It doesn't relay on Javascript or auto play at all. 它根本不依赖Javascript或自动播放。 It's just a simple audio tag with the source being provided by GoogleCloudStorage::serve() , which works everywhere except recently on iOS. 它只是一个简单的音频标签,其来源是由GoogleCloudStorage::serve() ,除了最近在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... 这是黑暗中的镜头,因为我对在iOS上播放音频文件一无所知,但万一有帮助...

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. 该网站以前曾播放过音频,但是在您提出问题时,该音频在OS X的Safari上停止工作。

The existing audio player that was being used was Flash based. 正在使用的现有音频播放器是基于Flash的。 I switched his website to playing audio using HTML5 and then it worked fine. 我将他的网站切换为使用HTML5播放音频,然后运行良好。

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. 因此,您可能需要检查是否正在使用Flash Player在iOS中播放音频,如果可以,将其更改为HTML5。

Do you rely on autoplay ? 您依靠自动播放吗? iOS disables autoplay, you really have to let the user touch a button, or something. iOS会禁用自动播放功能,实际上您必须让用户触摸按钮或其他东西。

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. 在iOS上的Safari(适用于包括iPad在内的所有设备)上的Safari中,用户可能位于蜂窝网络上,并按数据单元收费,因此禁用了预加载和自动播放功能。 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. 这意味着除非用户操作触发了play()load()方法,否则JavaScript play()load()方法在用户启动播放之前也处于无效状态。 In other words, a user-initiated Play button works, but an onLoad="play()" event does not. 换句话说,用户启动的“播放”按钮有效,但onLoad="play()"事件无效。

This plays the movie: <input type="button" value="Play" onclick="document.myMovie.play()"> 这将播放电影: <input type="button" value="Play" onclick="document.myMovie.play()">

This does nothing on iOS : <body onload="document.myMovie.play()"> 在iOS上不起作用: <body onload="document.myMovie.play()">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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