doublesymmetry / react-native-track-player

A fully fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!
https://rntp.dev/
Apache License 2.0
3.18k stars 981 forks source link

The Audio playback notification is still visible when the playback stops. #2193

Closed Ambreen-Kanwal20 closed 4 months ago

Ambreen-Kanwal20 commented 8 months ago

I'm using react-native-track-player@3.2.0. When I closed the application, The audio stopped but the playback notification was still visible.

Here is my track player setup code in index.js file.

const trackSetup = async () => await TrackPlayer.setupPlayer({ waitForBuffer: false, }).then( async () => { await TrackPlayer.updateOptions({ // stoppingAppPausesPlayback: true, android: { appKilledPlaybackBehavior: AppKilledPlaybackBehavior.StopPlaybackAndRemoveNotification, }, notificationCapabilities: [ Capability.Play, Capability.Pause, Capability.JumpBackward, Capability.JumpForward, Capability.SeekTo, ], capabilities: [ Capability.Play, Capability.Pause, Capability.JumpBackward, Capability.JumpForward, Capability.SeekTo, ], compactCapabilities: [Capability.Play, Capability.Pause], }); console.log(AppState.currentState, 'Track Player Setup...'); });

Kindly help/guide me to fix this issue. Every help is appreciated.

lovegaoshi commented 8 months ago

btw plz follow the issue template instead of deleting it RNTP 3.2 is realistically not maintained anymore. try upgrading to 4.0 first. what platform is this? android? if it is, look for AppKilledPlaybackBehavior.STOP_PLAYBACK_AND_REMOVE_NOTIFICATION in MusicService.kt and you're looking for stopForeground(true) to kill the notification; probably try a logcat there? there is also hideNotification() in kotlinaudio that also kills the notification when playback is not playing

Ambreen-Kanwal20 commented 8 months ago

btw plz follow the issue template instead of deleting it RNTP 3.2 is realistically not maintained anymore. try upgrading to 4.0 first. what platform is this? android? if it is, look for AppKilledPlaybackBehavior.STOP_PLAYBACK_AND_REMOVE_NOTIFICATION in MusicService.kt and you're looking for stopForeground(true) to kill the notification; probably try a logcat there? there is also hideNotification() in kotlinaudio that also kills the notification when playback is not playing

Updating the RNTP version to 4.0.1 has solved my issue in android. But now I'm getting errors in iOS. In QueueManager , SwiftAudioEx, I got the error.

Unable to infer complex closure return type; add explicit type to disambiguate.

Screenshot 2023-11-06 at 9 53 00 AM

Xcode version is: 13.2.1 RN version: 0.69.5 Could you guide me on what's the issue?

dcvz commented 8 months ago

@Ambreen-Kanwal20 you're 2 major versions behind on Xcode. I wonder if the issue is stemming from there.

github-actions[bot] commented 5 months ago

This issue 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] commented 4 months ago

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