Open Egbert-Jan opened 3 months ago
Hello @jspizziri @dcvz, could you maybe take a look at this pull request? I think it would be a useful feature. If something is wrong with it I could fix it.
Hey @Egbert-Jan we've been a bit busy, but I'll get to it as soon as I can.
Thanks I resolved the documentation and import issues. Have you also noticed I made a pull request here: https://github.com/doublesymmetry/KotlinAudio/pull/105. Those changed are needed for these to work.
@watadarkstar & @Egbert-Jan , it seems that there is some overlap between your two PRs (https://github.com/doublesymmetry/react-native-track-player/pull/2259). Can the two of you evaluate and and if I'm not mistaken, collaborate?
My pull request introduces the same functionality as #2259 for the iOS side. However it also adds the functionality to the Android side.
Just chiming in to say that I really appreciate the contributions on this issue, and I'm rooting for this to get merged! Would be super helpful to update these options on the fly after initialization.
This new functionality allows you to set the audioUsageType and audioContentType for Android, and the iosCategroy and iosCategoryMode for iOS with the updateOptions function. This makes it possible to force the audio to come through the earpiece speaker. This can for example be useful to play an audio message in a chat app. For this to work on Android I also made a pull request in KotlinAudio (https://github.com/doublesymmetry/KotlinAudio/pull/105). I tried but could not get the RNTP example app to use the updated KotlinAudio repo while executing the publishToMavenLocal steps as shown in https://github.com/doublesymmetry/react-native-track-player/tree/main/example.
Example: TrackPlayer.updateOptions({ iosCategory: IOSCategory.PlayAndRecord, iosCategoryMode: IOSCategoryMode.VoiceChat, androidAudioContentType: AndroidAudioContentType.Music, androidAudioUsageType: AndroidAudioUsageType.VoiceCommunication })