react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

feat: make it possible to play audio through the earpiece speaker

Open Egbert-Jan opened this issue 10 months ago • 6 comments

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 })

Egbert-Jan avatar Apr 02 '24 18:04 Egbert-Jan

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.

Egbert-Jan avatar Apr 17 '24 09:04 Egbert-Jan

Hey @Egbert-Jan we've been a bit busy, but I'll get to it as soon as I can.

dcvz avatar Apr 17 '24 09:04 dcvz

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.

Egbert-Jan avatar Apr 17 '24 14:04 Egbert-Jan

@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?

jspizziri avatar Apr 17 '24 16:04 jspizziri

My pull request introduces the same functionality as #2259 for the iOS side. However it also adds the functionality to the Android side.

Egbert-Jan avatar May 07 '24 10:05 Egbert-Jan

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.

tfkennedy777 avatar May 15 '24 00:05 tfkennedy777

This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 13 '24 01:08 github-actions[bot]

This PR was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Aug 21 '24 01:08 github-actions[bot]