Bug 1471485 - Ensure autoplay permission promises disconnected if media starts playing. r=jya
We can start playing while we're awaiting a response to an autoplay-media permission prompt, for example if the user clicks on a play button. In such cases, it doesn't make sense to keep the autoplay permission request promise connected in HTMLMediaElement, as since we're playing we'll be resolving the play() promises and thus we won't be taking action on the autoplay request promise's result. So we should just disconnect the autoplay permission request promise if it's connected when we start playing. MozReview-Commit-ID: 1aiCLXV7Ja9
This commit is contained in:
@@ -7866,6 +7866,12 @@ HTMLMediaElement::CreateDOMPromise(ErrorResult& aRv) const
|
||||
void
|
||||
HTMLMediaElement::AsyncResolvePendingPlayPromises()
|
||||
{
|
||||
// Disconnect requests for permission to play. We're playing either way,
|
||||
// so there's no point keeping the promise connected. Note: the front
|
||||
// end permission prompt code will detect that we've started playing, and
|
||||
// hide the permission prompt.
|
||||
mAutoplayPermissionRequest.DisconnectIfExists();
|
||||
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user