TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://thewidlarzgroup.github.io/react-native-video/
MIT License
7.19k stars 2.9k forks source link

[BUG]: (Android) Seeking backward after video ends resumes playback even though player was paused #4146

Closed paulrinaldi closed 1 month ago

paulrinaldi commented 1 month ago

Version

6.5.0

What platforms are you having the problem on?

Android

System Version

14

On what device are you experiencing the issue?

Real device, Simulator

Architecture

Old architecture

What happened?

See title.

Reproduction Link

repository link

Reproduction

Steps to reproduce this bug are:

After a video (using asset file mp4) ends in the basic example if you comment out the onEnd code, you'll notice these logs:

LOG  onPlaybackStateChanged {"isPlaying": false, "isSeeking": false}
LOG  onPlaybackRateChange {"playbackRate": 0}

Then when you drag the progress bar back (because it's hard to see, I enable the notification controls and pull it back to about halfway in the video), the video unpauses and you'll notice these logs:

LOG  onPlaybackRateChange {"playbackRate": 0}
LOG  onVideoBuffer
LOG  onPlaybackStateChanged {"isPlaying": true, "isSeeking": true}
LOG  onPlaybackRateChange {"playbackRate": 1}
LOG  onReadyForDisplay
LOG  onVideoBuffer

You will observe this visually: https://github.com/user-attachments/assets/f7758612-bd80-43c0-838f-97e4fec50f50

github-actions[bot] commented 1 month ago

Thank you for your issue report. Please note that the following information is missing or incomplete:

Please update your issue with this information to help us address it more effectively.

Note: issues without complete information have a lower priority

There is a newer version of the library available. You are using version 6.4.5, while the latest stable version is 6.5.0. Please update to the latest version and check if the issue still exists.

Note: If the issue still exists, please update the issue report with the latest information.

github-actions[bot] commented 1 month ago

Thank you for your issue report. Please note that the following information is missing or incomplete:

Please update your issue with this information to help us address it more effectively.

Note: issues without complete information have a lower priority

github-actions[bot] commented 1 month ago

Thank you for your bug report. We will review it and get back to you if we need more information.

paulrinaldi commented 1 month ago

I traced as much as I could in the android code, recorded log files, and scanned through them but I could not find why after seeking, the player resumes.

For now, after seek, if the state of my player is paused, I run playerRef.current.pause() right after playerRef.current.seek() and it does what I need it to do.

freeboub commented 1 month ago

I was able to reproduce it in the sample (it uses the prop instead of playerRef.current.pause() but it should be the same). here is a fix proposal: https://github.com/TheWidlarzGroup/react-native-video/pull/4147

I am not sure of the expected events when you pause after onEnd. Currently, only a playbackRateChange event is generated

paulrinaldi commented 1 month ago

I ran yarn run ios to compare but just got an error and white screen. Will try to get it running and compare. I think reflecting what iOS does would be acceptable or what RNV used to do (i.e. what dev's expect).

freeboub commented 1 month ago

I tested with the sample on ios, I don't reproduce the issue you describe... I have the same behavior than on android. And yes I agree we should have the same behavior on android and ios!