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

State.Buffering doesnt show / report in Android.

Open izyspania opened this issue 3 years ago • 4 comments

Describe the Bug Hi , seem that in any version higher than v2.1.3 State.Buffering doesnt show, am i missing something? Tested with v2.1.3, 2.2.0-RC4 , 3.0.0, 3.1.0 and next

With version v2.1.3: LOG Stored State: Playing / 3 - usePlaybackState: Buffering / 6 LOG Stored State: Buffering / 6 - usePlaybackState: Buffering / 6 LOG Stored State: Buffering / 6 - usePlaybackState: Playing / 3 LOG Stored State: Playing / 3 - usePlaybackState: Playing / 3 LOG Stored State: Playing / 3 - usePlaybackState: Buffering / 6 LOG Stored State: Playing / 3 - usePlaybackState: Playing / 3 LOG Stored State: Playing / 3 - usePlaybackState: Buffering / 6 LOG Stored State: Playing / 3 - usePlaybackState: Playing / 3 LOG Stored State: Playing / 3 - usePlaybackState: Buffering / 6 LOG Stored State: Buffering / 6 - usePlaybackState: Buffering / 6 LOG Stored State: Buffering / 6 - usePlaybackState: Stopped / 1 LOG Stored State: Stopped / 1 - usePlaybackState: Stopped / 1 LOG Stored State: Stopped / 1 - usePlaybackState: None / 0

The stored state is what im using and its working fine. With other versions im getting Paused state instead of Buffering when seekto / skiptonext etc.

With v3.1.0 LOG Stored State: Playing / 2 - usePlaybackState: Paused / 3 LOG Stored State: Paused / 3 - usePlaybackState: Paused / 3 LOG Stored State: Paused / 3 - usePlaybackState: Playing / 2 LOG Stored State: Playing / 2 - usePlaybackState: Playing / 2 LOG Stored State: Playing / 2 - usePlaybackState: Paused / 3 LOG Stored State: Playing / 2 - usePlaybackState: Playing / 2 LOG Stored State: Playing / 2 - usePlaybackState: Paused / 3 LOG Stored State: Paused / 3 - usePlaybackState: Paused / 3 LOG Stored State: Paused / 3 - usePlaybackState: Playing / 2 LOG Stored State: Playing / 2 - usePlaybackState: Playing / 2

// Seems to be working when paused (showing Connecting state) but not when playing (showing Paused state instead).

LOG we seek LOG Stored State: Connecting / 6 LOG Stored State: Connecting / 6 LOG Stored State: Ready / 1 LOG Stored State: Ready / 1 LOG we seek LOG Stored State: Connecting / 6 LOG Stored State: Connecting / 6 LOG Stored State: Ready / 1 LOG Stored State: Ready / 1 LOG Stored State: Ready / 1

Edit: Tested in Example app too and no "Buffering" state / event on Android.

I am not sure if this is related but im getting this warning when building: w: E:\EuCitesc\node_modules\react-native-track-player\android\src\main\java\com\doublesymmetry\trackplayer\module\MusicModule.kt: (11, 47): 'LocalBroadcastManager' is deprecated. Deprecated in Java w: E:\EuCitesc\node_modules\react-native-track-player\android\src\main\java\com\doublesymmetry\trackplayer\module\MusicModule.kt: (112, 27): 'LocalBroadcastManager' is deprecated. Deprecated in Java w: E:\EuCitesc\node_modules\react-native-track-player\android\src\main\java\com\doublesymmetry\trackplayer\module\MusicModule.kt: (214, 23): 'LocalBroadcastManager' is deprecated. Deprecated in Java w: E:\EuCitesc\node_modules\react-native-track-player\android\src\main\java\com\doublesymmetry\trackplayer\service\MusicService.kt: (7, 47): 'LocalBroadcastManager' is deprecated. Deprecated in Java w: E:\EuCitesc\node_modules\react-native-track-player\android\src\main\java\com\doublesymmetry\trackplayer\service\MusicService.kt: (428, 9): 'LocalBroadcastManager' is deprecated. Deprecated in Java

izyspania avatar Sep 10 '22 22:09 izyspania

Please try the nightly version – it includes a possible fix for this issue: https://github.com/doublesymmetry/react-native-track-player/commit/1b5bb02bbe1457902949ebd9c29829ba4998eb07

in usePlaybackState avoid possible race condition where setPlayerState could override the value received from the event listener by using callback version of setState by only setting if initial state is still missing

puckey avatar Sep 14 '22 09:09 puckey

@izyspania I'll close for now. Please test nightly. If you still have the issue I'll reopen.

jspizziri avatar Sep 14 '22 09:09 jspizziri

Sadly it does exactly the same , no Buffering state. "version": "3.1.0-7b247404c2b54df0550379277949a1cab5ddf47c", Edit: Tested with the example app too , it doesnt work.

izyspania avatar Sep 14 '22 15:09 izyspania

I am also seeing missing events still. I think the fix mentioned doesn't actually fix the underlying issue, which is a case of player state events overriding each other. Will make a separate pull request which hopefully fixes this for good.

puckey avatar Sep 21 '22 08:09 puckey

It seems to work fine now , good work, Thanks. Had some noise when playing (on android) but after i reinstalled the app and cleaned the cache it seems to work fine so far.

izyspania avatar Sep 24 '22 00:09 izyspania

@puckey, I'll leave this open until yours studies it's fixed completely.

jspizziri avatar Sep 24 '22 10:09 jspizziri

Should be fixed completely by https://github.com/doublesymmetry/react-native-track-player/pull/1713

puckey avatar Oct 12 '22 15:10 puckey

It works fine now , yes.

izyspania avatar Oct 12 '22 21:10 izyspania

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] avatar Jan 11 '23 02:01 github-actions[bot]

Closed by https://github.com/doublesymmetry/react-native-track-player/pull/1713

jspizziri avatar Jan 24 '23 16:01 jspizziri