-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YouTube videos do not seamlessly loop #408
Comments
Funnily enough this is what ReactPlayer already does. It seems like the I see what you mean about the very quick flash of black on every loop, but I'm not sure what can be done about it. |
@cookpete Yeah I discovered that 15 mins ago or so digging through the code. So basically.... is there no way to make looping actually work for YouTube vids? |
@cookpete It seems that the only way for seemless loops may be to not wait for the |
Funny you should mention it.. I was just putting a jsFiddle together for you doing exactly that: https://jsfiddle.net/o9vqq4L6/ Note that I've set |
@cookpete Two other things about this looping technique - it seems if the tab is not active, it won't fire enough (or at all?) in which case the video will end without looping. I added the The other thing is that these looped videos may be very different in length. So setting it as |
@cookpete this solution doesn't work on Safari. We still get a black frame |
@lteng1988 That sucks. My only other idea would be to have two looping players, but show/hide/fade between one another to avoid the black frame.. ..or don't use YouTube and just use a video file.
@matthew-dean Yeah you could just use |
While
react-player
seems to be using the YouTube API correctly, it would be nice if it provided a workaround for the fact that the YouTube API loop parameter fails completely at properly looping video. You can find a number of stack overflow references to it. However, it can be solved by seeking to the first frame and playing on the ended event of the video.If you use this URL: https://www.youtube.com/watch?v=f_JDEJGoU1Q in https://cookpete.com/react-player/, you'll see you get a black background briefly if you set the
loop
option, which shouldn't happen and is preventable. For example, here's a blog post about restarting the video on the ended event: https://codebushi.com/react-youtube-background/.The text was updated successfully, but these errors were encountered: