Bug 1391666 - P2. Reset mWaitingForKey when we have data and autoplay attribute is set r=cpearce

By default, a media element that has never played is in paused mode. As such, we need to reset mWaitingForKey to NOT_WAITING_FOR_KEY otherwise, readyState will never become HAVE_ENOUGH_DATA.

MozReview-Commit-ID: EIi3Crt4zHl
This commit is contained in:
Jean-Yves Avenard
2017-08-18 19:20:48 +02:00
parent 11228981bc
commit 459d4b6a28

View File

@@ -5919,11 +5919,15 @@ void HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState)
mReadyState >= nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA) {
DispatchAsyncEvent(NS_LITERAL_STRING("canplay"));
if (!mPaused) {
mWaitingForKey = NOT_WAITING_FOR_KEY;
NotifyAboutPlaying();
}
}
if (mReadyState >= nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
(!mPaused || mAutoplaying)) {
mWaitingForKey = NOT_WAITING_FOR_KEY;
}
CheckAutoplayDataReady();
if (oldState < nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA &&