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

fix: Wait for loadstart when changing sources, instead of just ready. #4743

Merged
merged 6 commits into from Nov 16, 2017

Conversation

Projects
None yet
2 participants
@misteroneill
Member

misteroneill commented Nov 13, 2017

The core goal here is to make sure the following works in light of some middleware process that makes setting the source more async than next tick:

player.src('...');
player.ready(() => player.play());

In fact, given this change, we should even be able to do:

player.src('...');
player.play();

Unlike #4665, which would have clarified/changed the meaning of "ready", it remains a reflection of the tech's state and we make better use of the ability to queue things on that state and on the middleware setSource process.

Requirements Checklist

  • Feature implemented / Bug fixed
  • Reviewed by Two Core Contributors
@gkatsev

Seems reasonable. Wondering if it's possible we fell through all the ifs in play.

this.playWaitingForReady_ = true;
this.ready(() => {
this.playWaitingForReady_ = false;

This comment has been minimized.

@gkatsev

gkatsev Nov 13, 2017

Member

can we set this in the constructor to a default value as well?

@gkatsev

gkatsev Nov 13, 2017

Member

can we set this in the constructor to a default value as well?

This comment has been minimized.

@misteroneill

misteroneill Nov 13, 2017

Member

Done.

@misteroneill
Show outdated Hide outdated src/js/player.js
playPromise.then(playFocus, ignoreRejectedPlayPromise);
if (isPromise(playPromise)) {
playPromise.then(playFocus, () => {});

This comment has been minimized.

@gkatsev

gkatsev Nov 13, 2017

Member

why not import silencePromise and use that?

@gkatsev

gkatsev Nov 13, 2017

Member

why not import silencePromise and use that?

This comment has been minimized.

@misteroneill

misteroneill Nov 13, 2017

Member

Copy/paste from my other PR, good call.

@misteroneill

misteroneill Nov 13, 2017

Member

Copy/paste from my other PR, good call.

This comment has been minimized.

@misteroneill

misteroneill Nov 13, 2017

Member

Oh, actually, we can't because it's not silencing it.

@misteroneill

misteroneill Nov 13, 2017

Member

Oh, actually, we can't because it's not silencing it.

This comment has been minimized.

@gkatsev

gkatsev Nov 13, 2017

Member

It isn't? What the difference between ignoreRejectedPlayPromise and silencePromise?

Oh, I see. We are silencing the playPromise but we're also adding a playFocus handler.

@gkatsev

gkatsev Nov 13, 2017

Member

It isn't? What the difference between ignoreRejectedPlayPromise and silencePromise?

Oh, I see. We are silencing the playPromise but we're also adding a playFocus handler.

This comment has been minimized.

@gkatsev

gkatsev Nov 13, 2017

Member

we could potentially do something like:

if (isPromise(playPromise)) {
  silencePromise(playPromise);
  playPromise.then(playFocus);
}
@gkatsev

gkatsev Nov 13, 2017

Member

we could potentially do something like:

if (isPromise(playPromise)) {
  silencePromise(playPromise);
  playPromise.then(playFocus);
}

This comment has been minimized.

@misteroneill

misteroneill Nov 13, 2017

Member

Seems like overkill...

@misteroneill

misteroneill Nov 13, 2017

Member

Seems like overkill...

This comment has been minimized.

@gkatsev

gkatsev Nov 13, 2017

Member

yeah, either way. using silencePromise is probably extra explicit/clear but either is fine.

@gkatsev

gkatsev Nov 13, 2017

Member

yeah, either way. using silencePromise is probably extra explicit/clear but either is fine.

misteroneill added some commits Nov 13, 2017

misteroneill added some commits Nov 13, 2017

@gkatsev

Seems to work for me and doesn't break videojs-playlist.

@gkatsev gkatsev merged commit 26b0d2c into master Nov 16, 2017

4 checks passed

continuous-integration/codeship Build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details

@gkatsev gkatsev deleted the ready-play branch Nov 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment