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

iOS 17 - TrackPlayer.pause on Shoutcast 2 Live Stream pauses the audio, but state does not update. #2151

Closed marcpope closed 9 months ago

marcpope commented 9 months ago

Describe the Bug This happens ONLY on a live streaming station.

After upgrading to iOS 17, my Radio App plays fine. However, when clicking the pause button and sending the TrackPlayer.pause command, the audio does stop, but the state is "Playing" still and there is no way to resume the audio unless I load a different station or podcast into TrackPlayer and play a new track. TrackPlayer.pause works fine on a .mp3 podcast (static file loaded from the web).

Video showing difference in iOS 16 vs iOS 17 (regardless of Track Player version): https://youtube.com/shorts/YUe0zqUYgkA?feature=share

Verified other phones with iOS 16 work fine.

Steps To Reproduce Add a new track to trackPlayer: newTrack: {"album": "AM 1340", "artist": "The Triad's Urban Gospel Station", "artwork": "https://truthnetwork.com/img/station-logos/WPOL-LG.png", "id": "7", "isLiveStream": true, "podcastid": "7", "title": "The Light - Triad (NC)", "tracktype": "live", "url": "https://stream.falconinternet.net:9028/;mp3"}

Code To Reproduce button in App: <TouchableOpacity onPress={() => { TrackPlayer.pause(); }} style={size}>

My Player at the bottom of the screen detects a button press and gets the latest state: const state = await TrackPlayer.getState(); console.log(state); Log: playing (previously, was paused).

Replicable on Example App? Can you replicate this bug in the React Native Track Player Example App? Haven't been able to try yet but my app uses very similar code.

Environment Info: Paste the results of npx react-native info info Fetching system and libraries information... System: OS: macOS 14.0 CPU: (24) arm64 Apple M2 Ultra Memory: 3.17 GB / 64.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.8.0 path: /opt/homebrew/bin/node Yarn: Not Found npm: version: 10.2.0 path: /opt/homebrew/bin/npm Watchman: version: 2023.10.02.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.13.0 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms:

Paste the exact react-native-track-player version you are using 3.2 (bug exists in current version, including my published app using 2.1.2)

Real device? Or simulator? Happens in both

What OS are you running? MacOS Sonoma 14.0

How I can Help What can you do to help resolve this? Glad to troubleshoot with anyone.

Have you investigated the underlying JS or Swift/Android code causing this bug? I have not. I am not super savvy there, sorry.

Can you create a Pull Request with a fix? I don't have a fix.

dcvz commented 9 months ago

This is a known bug with iOS 17. See https://github.com/doublesymmetry/react-native-track-player/issues/2124 - this was fixed in v4 RC but the workaround that you can apply in your app is this: https://github.com/doublesymmetry/react-native-track-player/issues/2124#issuecomment-1729441871

marcpope commented 9 months ago

thanks, that did fix it.