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.2k stars 984 forks source link

Inconsistent `PlaybackActiveTrackChanged` and `PlaybackQueueEnded` events dispatching across iOS/Android #2160

Closed kirillzyusko closed 9 months ago

kirillzyusko commented 9 months ago

Describe the Bug

When RepeatMode.Off and you listen last song in a queue -> when the song is finished different events will be dispatched across different OS. On iOS only PlaybackQueueEnded will be dispatched and on Android both PlaybackActiveTrackChanged and PlaybackQueueEnded will be dispatched.

Steps To Reproduce

Screenshots

Android iOS
image image

Expected result

I think iOS behavior is correct, because the track wasn't actually changed, so dispatching of PlaybackActiveTrackChanged seems to be not necessary.

Code To Reproduce

No code modifications in example app are required.

Replicable on Example App?

Issue is replicable in the React Native Track Player Example App

Environment Info:

Paste the results of npx react-native info

npx react-native info System: OS: macOS 13.5.1 CPU: (10) arm64 Apple M1 Pro Memory: 79.30 MB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10671973 Xcode: 15.0/15A240d - /usr/bin/xcodebuild Languages: Java: 11.0.14 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.4 => 0.66.4 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found

Paste the exact react-native-track-player version you are using

4.0.0-rc09

Real device? Or simulator?

Tested on both. iOS 17 and Android 14.

What OS are you running?

MacOS Ventura 13.5.1.

How I can Help

I'll create a PR with a fix soon.