Dev Center
All
Agora.io Community
Why can't I play the background music using startAudioMixing on Android 10?
Type: Integration issues    Platform: Android   Last Updated: 2020/11/12 00:10:46

Issue description

Cannot play an mp3, mp4, or any other music format using startAudioMixing on Android 10.

Reason

This is caused by an Android permission limit. If targetSdkVersion ≥ 29, you need to add relevant app privileges to play the a music file.

Solution

For Android projects with targetSdkVersion ≥ 29, add the following line in the application zone of the AndroidManifest.xml file to play the music file:

<application
   android:usesCleartextTraffic="true"
   android:requestLegacyExternalStorage="true"
   …
</application>

For more Android permission settings and considerations, see Add project permissions.

score