Bug 1464922 - Remove HTMLMediaElement::mAttemptPlayUponLoadedMetadata. r=bryce
We don't need to track this state anymore, as we don't need to delay calling MediaDecoder::Play() or delay firing the "playing" event anymore. MozReview-Commit-ID: E3B9l6ep7FP
This commit is contained in:
@@ -1812,7 +1812,6 @@ HTMLMediaElement::AbortExistingLoads()
|
||||
mPendingEncryptedInitData.Reset();
|
||||
mWaitingForKey = NOT_WAITING_FOR_KEY;
|
||||
mSourcePointer = nullptr;
|
||||
mAttemptPlayUponLoadedMetadata = false;
|
||||
|
||||
mTags = nullptr;
|
||||
|
||||
@@ -4098,17 +4097,8 @@ HTMLMediaElement::PlayInternal(ErrorResult& aRv)
|
||||
SetCurrentTime(0);
|
||||
}
|
||||
if (!mPausedForInactiveDocumentOrChannel) {
|
||||
if (mReadyState < HAVE_METADATA) {
|
||||
// We don't know whether the autoplay policy will allow us to play yet,
|
||||
// as we don't yet know whether the media has audio tracks. So delay
|
||||
// starting playback until we've loaded metadata.
|
||||
mAttemptPlayUponLoadedMetadata = true;
|
||||
} else {
|
||||
mDecoder->Play();
|
||||
}
|
||||
mDecoder->Play();
|
||||
}
|
||||
} else if (mReadyState < HAVE_METADATA) {
|
||||
mAttemptPlayUponLoadedMetadata = true;
|
||||
}
|
||||
|
||||
if (mCurrentPlayRangeStart == -1.0) {
|
||||
@@ -4169,8 +4159,7 @@ HTMLMediaElement::PlayInternal(ErrorResult& aRv)
|
||||
NotifyAboutPlaying();
|
||||
break;
|
||||
}
|
||||
} else if (mReadyState >= HAVE_FUTURE_DATA &&
|
||||
!mAttemptPlayUponLoadedMetadata) {
|
||||
} else if (mReadyState >= HAVE_FUTURE_DATA) {
|
||||
// 7. Otherwise, if the media element's readyState attribute has the value
|
||||
// HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA, take pending play promises and
|
||||
// queue a task to resolve pending play promises with the result.
|
||||
@@ -5002,7 +4991,7 @@ HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder)
|
||||
mDecoder->Suspend();
|
||||
}
|
||||
|
||||
if (!mPaused && !mAttemptPlayUponLoadedMetadata) {
|
||||
if (!mPaused) {
|
||||
SetPlayedOrSeeked(true);
|
||||
if (!mPausedForInactiveDocumentOrChannel) {
|
||||
mDecoder->Play();
|
||||
@@ -6049,16 +6038,6 @@ HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState)
|
||||
|
||||
UpdateAudioChannelPlayingState();
|
||||
|
||||
if (oldState < HAVE_METADATA && mReadyState >= HAVE_METADATA &&
|
||||
mAttemptPlayUponLoadedMetadata) {
|
||||
mAttemptPlayUponLoadedMetadata = false;
|
||||
if (!mPaused && !IsAllowedToPlay()) {
|
||||
mPaused = true;
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("pause"));
|
||||
AsyncRejectPendingPlayPromises(NS_ERROR_DOM_MEDIA_NOT_ALLOWED_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle raising of "waiting" event during seek (see 4.8.10.9)
|
||||
// or
|
||||
// 4.8.12.7 Ready states:
|
||||
@@ -6213,7 +6192,6 @@ HTMLMediaElement::CheckAutoplayDataReady()
|
||||
if (mCurrentPlayRangeStart == -1.0) {
|
||||
mCurrentPlayRangeStart = CurrentTime();
|
||||
}
|
||||
MOZ_ASSERT(!mAttemptPlayUponLoadedMetadata);
|
||||
mDecoder->Play();
|
||||
} else if (mSrcStream) {
|
||||
SetPlayedOrSeeked(true);
|
||||
@@ -6577,7 +6555,6 @@ HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement,
|
||||
if (mDecoder) {
|
||||
mDecoder->Resume();
|
||||
if (!mPaused && !mDecoder->IsEnded()) {
|
||||
MOZ_ASSERT(!mAttemptPlayUponLoadedMetadata);
|
||||
mDecoder->Play();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user