Open stevemao opened 9 years ago
Also if autoplay is false, I think it shouldn't force a play but instead defer all events and once the video starts to play, dispatch these events. This way user will not see the initial play and pause, and can still see the initial image on the video (if letting user see the image is one of the purposes of not playing it automatically).
That's to trigger a ready state and start buffering.
Otherwise it won't buffer until the user hits play, causing a wait.
Well, if autoplay is true this does not make too much difference (only one split second wait for buffering) but a glitch.
If autoplay is false I think it would be better to let dev choose if they want the video start buffering or not.
Maybe we can attach this functionality to preload?
Example, if preload is true, it goes through the existing play/pause hack to trigger buffering, if preload is false, it waits for user interaction before buffering?
The reason for the need to reduce the wait as much as possible, even if it is a split second, is to have wrappers sequenced together and seemingly play as one clip.
I never could get YouTube working well on ios, so it never was a priority.
Also might be possible to hide the video until a loadedmetadata event is fired, then display it, hiding the glitch.
I like the preload option. :+1:
I'm not sure how well it works to hide the glitch. Does it hide the sound as well? Will it cause a different kind of glitch? There are too much to test I think.
Yeah sound does get muted, but youtube has sync issues with their muted event and what actually happens when it is Flash.
Come to think of it, now that YouTube has HTML5 used in most cases, which performs much better than flash back when I first wrote this hack, that the delay might not be too bad.
It used to cause a delay of 2-3 seconds when it was only Flash.
Might be worth investigating removing the hack.
:+1: Makes sense
YouTube player auto plays and pauses at the beginning. I can understand if autoplay is false but if its true , there is an obvious glitch. This is more obvious on iPad.
Reading through the source in
popcorn.HTMLYouTubeVideoElement.js
It forces an initial play on the video and then pause. This causes the glitch. I modified the source so the video will not pause but still running fine. What's the intentions of the play, pause and play logic if autoplay is true or its a bug?