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

--HG--
extra : rebase_source : e9f9ad4136020db7db081b5c125f664e1c7bda20
This commit is contained in:
Jean-Yves Avenard 2017-08-18 19:20:48 +02:00
parent aefd5c8c8a
commit 34fd923c04

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 &&