After I upgrade to android 11 (API 30), I am getting problem with cordova-plugin-media. Its not playing audio stream .. When I click play audio, output was: Error: 1 (which refers to MediaError.MEDIA_ERR_ABORTED = 1) I Have an app builder, In which 20K apps that depends on this plugin (required this feature)- I don't required to record and play. We use web stream e.g (-[(http://streams.radiobob.de/bob-chillout/aac-64/streams.radiobob.de/)]) and just want to play this audio stream on button click. Here is config.xml, I am using-
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gap="http://phonegap.com/ns/1.0" id="app.*********" version="3.6.1" android-versionCode="30">
<name>******</name>
<description />
<author href="444656972743" email="">*********</author>
<preference name="orientation" value="portrait" />
<preference name="fullscreen" value="false" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="android-build-tool" value="gradle" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="AllowInlineMediaPlayback" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="android-minSdkVersion" value="22" />
<preference name="android-targetSdkVersion" value="30" />
<feature name="NetworkStatus">
<param name="android-package" value="org.apache.cordova.networkinformation.NetworkManager"
/>
</feature>
<feature name="SocialSharing">
<param name="android-package" value="nl.xservices.plugins.SocialSharing" />
</feature>
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" />
</feature>
<feature name="Notification">
<param name="android-package" value="org.apache.cordova.dialogs.Notification" />
</feature>
<feature name="PushPlugin">
<param name="android-package" value="com.plugin.gcm.PushPlugin" />
</feature>
<plugin name="cordova-plugin-keyboard" source="npm" spec="1.2.0" />
<plugin name="cordova-plugin-device" source="npm" spec="1.1.7" />
<platform name="android">
<preference name="AndroidXEnabled" value="true" />
<preference name="AndroidInsecureFileModeEnabled" value="true" />
<resource-file src="google-services.json" target="app/google-services.json" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<icon src="icons/android-ldpi.png" density="ldpi" />
<icon src="icons/android-mdpi.png" density="mdpi" />
<icon src="icons/android-hdpi.png" density="hdpi" />
<icon src="icons/android-xhdpi.png" density="xhdpi" />
<icon src="icons/android-xxhdpi.png" density="xxhdpi" />
<icon src="icons/android-xxxhdpi.png" density="xxxhdpi" />
<icon src="icons/android-xxhdpi.png" density="fr-xxhdpi" />
<splash src="splashscreen/android-ldpi.png" density="ldpi" />
<splash src="splashscreen/android-mdpi.png" density="mdpi" />
<splash src="splashscreen/android-hdpi.png" density="hdpi" />
<splash src="splashscreen/android-xhdpi.png" density="xhdpi" />
<splash src="splashscreen/android-xxhdpi.png" density="fr-xhdpi" />
<splash src="splashscreen/android-xxhdpi.png" density="land-xxhdpi" />
<splash src="splashscreen/android-xxhdpi.png" density="port-xxhdpi" />
<splash src="splashscreen/android-xxxhdpi.png" density="xxxhdpi" />
<preference name="KeepRunning" value="true" />
</platform>
<access origin="*" subdomains="true" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="https://www.youtube.com/*" />
<allow-navigation href="http://www.youtube.com/*" />
<allow-navigation href="https://player.vimeo.com/*" />
<allow-navigation href="http://player.vimeo.com/*" />
<plugin name="cordova-plugin-media" spec="~5.0.3">
<variable name="KEEP_AVAUDIOSESSION_ALWAYS_ACTIVE" value="NO" />
</plugin>
<plugin name="cordova-plugin-androidx-adapter" source="npm" spec="1.1.1" />
<plugin name="cordova-plugin-camera" source="npm" spec="4.0.3" />
<plugin name="cordova-plugin-inappbrowser" source="npm" spec="4.0.0" />
<plugin name="cordova-plugin-globalization" source="npm" spec="1.0.9" />
<plugin name="cordova-plugin-network-information" source="npm" spec="2.0.1" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-x-socialsharing" source="npm" spec="6.0.0" />
<plugin name="cordova-plugin-dialogs" source="npm" spec="2.0.1" />
<plugin name="cordova-sqlite-evcore-extbuild-free" spec="0.14.0" source="npm" />
</widget>
I appreciate any solution or workaround..
I was getting the same error. Luckily, there is an official release of cordova-plugin-media that also fix this issue:
[email protected]