Skip to content
This repository has been archived by the owner on Jun 29, 2018. It is now read-only.

YouTube player auto starts and pauses at the beginning even if autoplay is true. #430

Open
stevemao opened this issue Jan 21, 2015 · 7 comments

Comments

@stevemao
Copy link

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?

@stevemao stevemao changed the title YouTube player auto starts and pause at the beginning. YouTube player auto starts and pauses at the beginning even if autoplay is true. Jan 21, 2015
@stevemao
Copy link
Author

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).

@ScottDowne
Copy link
Contributor

That's to trigger a ready state and start buffering.

Otherwise it won't buffer until the user hits play, causing a wait.

@stevemao
Copy link
Author

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.

@ScottDowne
Copy link
Contributor

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.

@stevemao
Copy link
Author

I like the preload option. 👍

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.

@ScottDowne
Copy link
Contributor

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.

@stevemao
Copy link
Author

👍 Makes sense

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants