mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1302350 - part6 : ensure loading process doens't be interrupted even media element can't be played. r=jwwang
We don't want to stop the loading process even we canceled the play operation. MozReview-Commit-ID: FyPqBlDKYo0 --HG-- extra : rebase_source : fdbc4390a7763bdbe26e8b809d977234bb5360ea
This commit is contained in:
parent
5476b14a53
commit
9e8e7969e0
@ -3031,6 +3031,7 @@ void
|
||||
HTMLMediaElement::Play(ErrorResult& aRv)
|
||||
{
|
||||
if (!IsAllowedToPlay()) {
|
||||
MaybeDoLoad();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3049,9 +3050,7 @@ HTMLMediaElement::PlayInternal()
|
||||
StopSuspendingAfterFirstFrame();
|
||||
SetPlayedOrSeeked(true);
|
||||
|
||||
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
|
||||
DoLoad();
|
||||
}
|
||||
MaybeDoLoad();
|
||||
if (mSuspendedForPreloadNone) {
|
||||
ResumeLoad(PRELOAD_ENOUGH);
|
||||
}
|
||||
@ -3117,9 +3116,18 @@ HTMLMediaElement::PlayInternal()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::MaybeDoLoad()
|
||||
{
|
||||
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
|
||||
DoLoad();
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::Play()
|
||||
{
|
||||
if (!IsAllowedToPlay()) {
|
||||
MaybeDoLoad();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1272,6 +1272,9 @@ protected:
|
||||
// A method to check whether the media element is allowed to start playback.
|
||||
bool IsAllowedToPlay();
|
||||
|
||||
// If the network state is empty and then we would trigger DoLoad().
|
||||
void MaybeDoLoad();
|
||||
|
||||
// True if the tab which media element belongs to has been to foreground at
|
||||
// least once or activated by manually clicking the unblocking tab icon.
|
||||
bool IsTabActivated() const;
|
||||
|
Loading…
Reference in New Issue
Block a user