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

seekTo triggers onPlay for YouTube

Open ro0sterjam opened this issue 6 years ago • 2 comments

Current Behavior

When the onPlay handler issues a seekTo command, it triggers onPlay again, causing a continuous loop. This does not seem to effect SoundCloud where onPlay is not triggered by seekTo

Expected Behavior

onPlay should not be triggered by seekTo. Or at the very least YouTube and SoundCloud should have consistent behaviour

Steps to Reproduce

  1. Set onPlay to seekTo(x)
  2. Play video

Environment

  • URL attempting to play: https://www.youtube.com/watch?v=HuC2MUmQaG4&list=PL231EC31AA8EDC28E
  • Browser: Chrome
  • Operating system: OSX
  • jsFiddle example: https://jsfiddle.net/y61uwfvg/

ro0sterjam avatar Mar 20 '20 07:03 ro0sterjam

Playing after seek is a behaviour of the Youtube API and can't be controlled, as far as I know.

If you're trying to start the video from a certain time, use the start player parameter.

cookpete avatar Mar 20 '20 07:03 cookpete

See also: https://github.com/CookPete/react-player/issues/601

cookpete avatar Mar 25 '20 19:03 cookpete