简体   繁体   English

创建JS WebAudioPlugin不会回退到HTMLAudioPlugin Facebook浏览器Android 4.4

[英]Create JS WebAudioPlugin doesn't fallback to HTMLAudioPlugin Facebook Browser Android 4.4

I am currently using the CreateJS suite for audio and various purposes and I am getting an error on the Facebook Browser on Android 4.4 It seems that the WebAudioPlugin isn't supported however it doesn't fallback to HTMLAudio as specified in the CreateJS docs: 我目前正在使用CreateJS套件用于音频和各种用途,我在Android 4.4上的Facebook浏览器上出现错误。似乎不支持WebAudioPlugin,但它不会像CreateJS文档中指定的那样回退到HTMLAudio:

"This plugin is the second priority plugin installed by default, after the WebAudioPlugin." “这个插件是WebAudioPlugin之后默认安装的第二优先插件。”

This is currently how I'm registering plugins when they break. 这是我正在注册插件的方式。

createjs.Sound.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin]);

However if I change the order it works. 但是,如果我更改它的工作顺序。

createjs.Sound.registerPlugins([createjs.HTMLAudioPlugin, createjs.WebAudioPlugin]);

I am not entirely sure what impact this has and I'd like to prioritize WebAudio over HTMLAudio so I'm not sure if there are implications like that for changing the order. 我不完全确定它有什么影响,我想优先考虑WebAudio而不是HTMLAudio,所以我不确定是否有类似改变订单的含义。 Is WebAudio still prioritized if I register the plugins in this order? 如果按此顺序注册插件,WebAudio仍然是优先级吗? or if not is there a way to ensure that WebAudio falls back to HTMLAudio? 或者如果没有办法确保WebAudio回归到HTMLAudio?

Resolved this by adding my own conditional for Facebook to BrowserDetect as I saw that Createjs doesn't have a check for this in it's isSupported function only standard IOS, Android etc. 通过将我自己的Facebook条件添加到BrowserDetect解决了这个问题,因为我看到Createjs没有检查它的isSupported函数只有标准的IOS,Android等。

BrowserDetect.isFacebookBrowser = (/FBAN/i.test(agent) || /FBAV/i.test(agent) || /FB_IAB/i.test(agent));

By combining this with the Android check you can create a fallback for Facebook on Android. 通过将其与Android检查相结合,您可以在Android上为Facebook创建后备。

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

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