微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使HTML5音频api在IOS的Cordova Angular项目中在后台运行?

如何解决如何使HTML5音频api在IOS的Cordova Angular项目中在后台运行?

我有一个Cordova Angular项目,该项目使用HTML5 Audio API播放音频。将WKWebview插件添加到项目后,该应用将在IOS中停止在后台播放。

此外,在config.xml中将WKSuspendInBackground值设置为false。

这是我的config.xml。

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.syncyourfocus" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>SyncYourFocus</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="WKSuspendInBackground" value="false" />
    <feature name="SplashScreen">
        <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
    </feature>
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="8000" />
    <preference name="ShowSplashScreenSpinner" value="false" />
    <preference name="FadeSplashScreenDuration" value="1000"/>
    <platform name="android">
        <allow-intent href="market:*" />

           </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <preference name="WKWebViewOnly" value="true" />
        <preference name="WKSuspendInBackground" value="false" />
     
       </platform>
</widget>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。