Bug 1298594: P2. Fire waiting event when readyState move back to HAVE_CURRENT_DATA. r=jwwang
MozReview-Commit-ID: BpwYY6njXGC
This commit is contained in:
@@ -2882,7 +2882,6 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
|
||||
mPlayingThroughTheAudioChannelBeforeSeek(false),
|
||||
mPausedForInactiveDocumentOrChannel(false),
|
||||
mEventDeliveryPaused(false),
|
||||
mWaitingFired(false),
|
||||
mIsRunningLoadMethod(false),
|
||||
mIsDoingExplicitLoad(false),
|
||||
mIsLoadingFromSourceChildren(false),
|
||||
@@ -4775,11 +4774,6 @@ HTMLMediaElement::UpdateReadyStateInternal()
|
||||
if (mFirstFrameLoaded) {
|
||||
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
|
||||
}
|
||||
if (!mWaitingFired && nextFrameStatus == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING) {
|
||||
FireTimeUpdate(false);
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("waiting"));
|
||||
mWaitingFired = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4838,9 +4832,24 @@ void HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState)
|
||||
UpdateAudioChannelPlayingState();
|
||||
|
||||
// Handle raising of "waiting" event during seek (see 4.8.10.9)
|
||||
// or
|
||||
// 4.8.12.7 Ready states:
|
||||
// "If the previous ready state was HAVE_FUTURE_DATA or more, and the new
|
||||
// ready state is HAVE_CURRENT_DATA or less
|
||||
// If the media element was potentially playing before its readyState
|
||||
// attribute changed to a value lower than HAVE_FUTURE_DATA, and the element
|
||||
// has not ended playback, and playback has not stopped due to errors,
|
||||
// paused for user interaction, or paused for in-band content, the user agent
|
||||
// must queue a task to fire a simple event named timeupdate at the element,
|
||||
// and queue a task to fire a simple event named waiting at the element."
|
||||
if (mPlayingBeforeSeek &&
|
||||
mReadyState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA) {
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("waiting"));
|
||||
} else if (oldState >= nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
|
||||
mReadyState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
|
||||
!Paused() && !Ended() && !mError) {
|
||||
FireTimeUpdate(false);
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("waiting"));
|
||||
}
|
||||
|
||||
if (oldState < nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA &&
|
||||
@@ -4850,10 +4859,6 @@ void HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState)
|
||||
mLoadedDataFired = true;
|
||||
}
|
||||
|
||||
if (mReadyState == nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA) {
|
||||
mWaitingFired = false;
|
||||
}
|
||||
|
||||
if (oldState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
|
||||
mReadyState >= nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA) {
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("canplay"));
|
||||
|
||||
Reference in New Issue
Block a user