Skip to content
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

Adjusting autoplay to properly wait for loadstart event. #1262

Closed
wants to merge 1 commit into from

Conversation

jnwng
Copy link
Contributor

@jnwng jnwng commented Jun 4, 2014

Since moving the loadstart into the player.ready function here, there
exists a race condition whereby the player emits a play event
before the loadstart event, but since onLoadStart was waiting
for that play event, the play button never goes away.

alternatively, we could adjust https://github.com/videojs/video.js/blob/master/src/js/player.js#L412-L413 to instead wait for the playing event instead of the play event, since we know that the playing event will always be after the loadstart, whereas play is not guaranteed to be so.

Since moving the loadstart into the `player.ready` function, there
exists a race condition whereby the player emits a `play` event
before the `loadstart` event, but since `onLoadStart` was waiting
for that `play` event, the play button never goes away.
@mmcc mmcc added bug labels Jun 4, 2014
@mmcc
Copy link
Member

mmcc commented Jun 4, 2014

This is great, thank you for addressing this. This should address #1245, as well as #1237 (and others).

@jnwng
Copy link
Contributor Author

jnwng commented Jun 4, 2014

Actually, after reviewing the other issues, I think the proper solution
would be to have onLoadStart wait for the 'playing' event and not the
'play' event, since it looks like many people will call 'play' in the ready
block, not just for the case I have here.

@Mewte
Copy link

Mewte commented Jun 4, 2014

I'm trying to call .play() in the ready block and it never removes the big play button or shows the controls. If I call play inside this.one('loadstart', function(){}); inside the ready event it does work, however. Is this issue related to that bug? I've been searching for hours to see if anyone has the same problem and this seems to be the closest issue I've seen.

@heff
Copy link
Member

heff commented Jun 10, 2014

@jnwng Working on the onLoadStart fix you mention here in #1271

@heff
Copy link
Member

heff commented Jun 11, 2014

@jnwng, 4.6.2 is out with a patch. Can you check to make sure that fixes the issue you saw?

@jnwng
Copy link
Contributor Author

jnwng commented Jun 11, 2014

yep, this fixes it. thanks @heff!

@jnwng jnwng closed this Jun 11, 2014
@jnwng jnwng deleted the jw/fix-autoplay branch June 11, 2014 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants