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

Silenced play() promise #6070

Conversation

Wicker25
Copy link

@Wicker25 Wicker25 commented Jun 24, 2019

Description

It seems like the method Player.play() tries to silence the tech promises only when the promises are not supported.

i.e. If we run the following code in Chrome 75:

var player = window.player = videojs('video-element');
player.ready(function () {
  player.play();
  player.pause();
});

the browser will show the error message Uncaught (in promise) DOMException: The play() request was interrupted.

I don't think this is the expected behaviour because by default the private method play_() wraps the promises returned by the tech method with silencePromise(). (https://github.com/videojs/video.js/blob/master/src/js/player.js#L2274)

The method Player.play(), however, overrides that argument with the resolve of the new promise.

Related issues

@welcome
Copy link

welcome bot commented Jun 24, 2019

💖 Thanks for opening this pull request! 💖

Things that will help get your PR across the finish line:

  • Run npm run lint -- --errors locally to catch formatting errors earlier.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@gkatsev
Copy link
Member

gkatsev commented Jun 24, 2019

We specifically do not want to silence the promise in all cases because then a Video.js user will not be able to know when and if the Promise was rejected since for them it'll always be resolved.
We should be only silencing the promise whenever it isn't being returned to the user as they can't handle it themselves at that point.

@gkatsev gkatsev closed this Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants