-
-
Notifications
You must be signed in to change notification settings - Fork 764
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
Add support for looping video playback #460
Comments
I'm unable to create a branch to push a commit and open a PR, so I'm attaching a patch file that shows one way to add support for looping, which can be applied locally via |
Hey, why is it a problem to loop the video manually? (manually restart after it ends) |
When I briefly experimented with YouTube's built-in looping, it seemed a
little smoother than calling seek to zero and play when the ENDED event is
received.
It also seems like it's something the library should support, since the
YouTube iframe API supports it.
Perhaps a generic means of passing in playerVar settings would be a better
approach, to give access to options not explicitly supported by this
library?
…On Wed, Oct 23, 2019, 11:00 AM Pierfrancesco Soffritti < ***@***.***> wrote:
Hey, why is it a problem to loop the video manually? (manually restart
after it ends)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#460?email_source=notifications&email_token=AABUBRX663HP5SNAVVZAZGLQQBYIZA5CNFSM4JDTBWSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECB6MSQ#issuecomment-545515082>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABUBRXP4KYKO4XXGWK6YJLQQBYIZANCNFSM4JDTBWSA>
.
|
Hey, sorry these days I don't have much time to work on the library. Feel free to send a pull requests, if you have ideas we can discuss them there. |
This will be available in version 12.1.0 which releases sometimes this week. |
According to official YouTube documentation, we should be able to add loop and playlist variables to playerVars to enable automatic looping of video playback: https://developers.google.com/youtube/player_parameters#loop
The android-youtube-player API does not support this, and it would be great if it did.
Note: I have experimented with this locally, by modifying
IFramePlayerOptionsExampleActivity
andIFramePlayerOptions.kt
to send in the loop and playlist variables, and I was unable to get it working. Then I modifiedWebViewYouTubePlayer.loadVideo()
to call"javascript:loadPlaylist('$videoId',0, $startSeconds)"
instead of"javascript:loadVideo('$videoId', $startSeconds)"
, and looping started working. Of course, this also caused the YouTube UI to show an additional control for the playlist (even though there was only one video), so this would not be an acceptable solution.I'll give some thought to how best to handle the scenario where we want to loop playback on a single video. One option would be for
WebViewYouTubePlayer
to keep a reference to theIFramePlayerOptions
passed intoinitialize()
, and then callloadPlaylist()
when theloop
option has been set to 1.The text was updated successfully, but these errors were encountered: