简体   繁体   English

CocoonJS SoundJS无法在iOS上播放

[英]Cocoonjs soundjs not playing on ios

We're building an html project using cocoonjs webview+, but soundjs doesn't play when we open our app on ios. 我们正在使用cocoonjs webview +构建html项目,但是当我们在ios上打开应用程序时,soundjs无法播放。

Everything works fine on android in webview+, and we've tried mp3, ogg, and m4v sound files with ios. 在webview +上的android上一切正常,并且我们已经在ios上尝试了mp3,ogg和m4v声音文件。 Does anyone have any idea what we could try next. 有谁知道我们接下来可以尝试什么。

This is applying to both autoplay sounds, and sounds that are triggered by user interaction (eg in onclick handlers). 这既适用于自动播放声音,也适用于由用户交互触发的声音(例如,在onclick处理程序中)。

It looks like Cocoonjs is based on Cordova, so you should be able to use the new CordovaAudioPlugin with the lastest SoundJS-Next . 看起来Cocoonjs是基于Cordova的,因此您应该能够将新的CordovaAudioPlugin与最新的SoundJS-Next一起使用

Previously there have been problems the default WebAudioPlugin because it requires XHR to load audio with is not available for local files. 以前,默认WebAudioPlugin存在问题,因为它要求XHR加载音频,而本地文件不可用。 People got around this by not using default plugins and instead registering HTMLAudioPlugin. 人们通过不使用默认插件来解决此问题,而是注册了HTMLAudioPlugin。

Also, iOS web sites requires audio to be played inside a user event, but I'm not sure if this same restriction is applied to webviews. 另外,iOS网站要求在用户事件中播放音频,但是我不确定是否将相同的限制应用于Webview。 If it is, the Mobile Safe Tutorial might be useful. 如果是这样,则“ 移动安全教程”可能会有用。

Hope that helps. 希望能有所帮助。

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

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