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

player.play() can be invoked before the firstplay handler is setup? #1245

Closed
jgubman opened this issue May 27, 2014 · 3 comments
Closed

player.play() can be invoked before the firstplay handler is setup? #1245

jgubman opened this issue May 27, 2014 · 3 comments

Comments

@jgubman
Copy link
Contributor

jgubman commented May 27, 2014

This is a 4.6.1 issue, functionality seemed fine in 4.4.3

With a fairly contrived example where we implement autoplay by calling player.play inside the ready handler like:

videojs('example').ready(function() {
  ....  
  this.play();
})

the 'vjs-has-started' class never gets added to this.el_

Also possible that the onLoadstart event is removing 'vjs-has-started', but it looks like the class never gets added because the onFirstPlay event never gets fired.

I hacked around it by adding:

  if (!this.paused()) {
    vjs.trigger(this.el_, { type: 'play', target: this.el_ });
  }

to the onLoadStart function, but not sure that's a great approach

Here's a simple example:
http://jsfiddle.net/2qAeT/1/

Edits by @mmcc: Added code blocks for readability

@mmcc mmcc added bug labels May 28, 2014
@mmcc
Copy link
Member

mmcc commented May 28, 2014

This is a great rundown of what's happening in #1237. I haven't had a chance to dig in yet, but when I started seeing these issues I assumed this is where the problem was (I made the changes to reset the player, so this one's on me). Thanks for the description, I'll try and get a fix out as soon as I can, but with @heff getting his learn on at JSConf it will be probably be a minute before we get a minor version update deployed. In the meantime, your fix should solve the problem, so thanks for sharing.

@sharkiller
Copy link

yes i run with the same problem with latest builds. 4.6.0 worked fine to me. i needed to force vjs-has-started externally until is fixed. happend the same that #1237 too and need to remove the bug play from the list too.

@mmcc
Copy link
Member

mmcc commented Jun 13, 2014

This would should be resolved with the merge of #1271.

@mmcc mmcc closed this as completed Jun 13, 2014
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants