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

Return the native Promise from play() #3907

Merged
merged 3 commits into from
Jan 18, 2017
Merged

Return the native Promise from play() #3907

merged 3 commits into from
Jan 18, 2017

Conversation

brandonocasey
Copy link
Contributor

Description

Return a Promise from play() originally this was a PR off of #3860 (https://github.com/BrandonOCasey/video.js/pull/4). This has been changed to be standalone.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chome, Firefox, IE)
    • Unit Tests updated or fixed
  • Reviewed by Two Core Contributors

@brandonocasey
Copy link
Contributor Author

brandonocasey commented Jan 3, 2017

Still have to work on this comment from gkatsev https://github.com/BrandonOCasey/video.js/pull/4#discussion_r93505152

@brandonocasey brandonocasey changed the title Return a Promise from play() Return the native Promise from play() Jan 9, 2017
@brandonocasey
Copy link
Contributor Author

#3927

return native play value if possible when play is called
this.tech_.one('loadstart', function() {
this.play();
});
return this.techGet_('play');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, this is an interesting case for the techget/techcall dichotomy. play is still technically a setter, which is why techcall is used, but we want its return value. I wonder if we need to get rid the the difference. This is particularly important because of how middleware work. We're bubbling techCalls from the player to the tech and techGets from the tech to the player.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think that we should get rid of the difference

}

return this;
this.tech_.one('loadstart', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a source but it's of an unknown type, this throws as this.tech_ is undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I just wrap the loadstart listener in an if (this.tech_) check then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.ready()

@misteroneill
Copy link
Member

@mister-ben Could you take another look at this? I think the issue you brought up was addressed.

@mister-ben
Copy link
Contributor

Sure, will get a chance to look properly next week.

@gkatsev gkatsev merged commit 091bdf9 into videojs:master Jan 18, 2017
@thecotne
Copy link
Contributor

thecotne commented Dec 7, 2017

so on chrome 62 where native videoTag.play() returns promise

this should return promise right?

i am asking becouse it does not return anything

@gkatsev
Copy link
Member

gkatsev commented Dec 7, 2017

Video.js 6 will, yes. Video.js 5 will not.

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

Successfully merging this pull request may close these issues.

5 participants