如何使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 (将#修改为@)