Bug 1299096 - Remove the event-based play() method out from nsIDOMHTMLMediaElement.idl; r?bz
MozReview-Commit-ID: 3pHsSsADPLu
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -880,19 +880,22 @@ private:
if (!IsSuspended()) {
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
("HTMLMediaElement::AudioChannelAgentCallback, ResumeFromAudioChannel, "
"this = %p, Error : resume without suspended!\n", this));
return;
}
SetSuspended(nsISuspendedTypes::NONE_SUSPENDED);
- nsresult rv = mOwner->Play();
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return;
+ IgnoredErrorResult rv;
+ RefPtr<Promise> toBeIgnored = mOwner->Play(rv);
+ MOZ_ASSERT_IF(toBeIgnored && toBeIgnored->State() == Promise::PromiseState::Rejected,
+ rv.Failed());
+ if (rv.Failed()) {
+ NS_WARNING("Not able to resume from AudioChannel.");
}
}
void
Suspend(SuspendTypes aSuspend)
{
if (IsSuspended()) {
return;
@@ -3862,33 +3865,16 @@ HTMLMediaElement::PlayInternal(ErrorResu
void
HTMLMediaElement::MaybeDoLoad()
{
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
DoLoad();
}
}
-NS_IMETHODIMP HTMLMediaElement::Play()
-{
- if (mAudioChannelWrapper && mAudioChannelWrapper->IsPlaybackBlocked()) {
- MaybeDoLoad();
- return NS_OK;
- }
-
- ErrorResult rv;
- RefPtr<Promise> toBeIgnored = PlayInternal(rv);
- if (rv.Failed()) {
- return rv.StealNSResult();
- }
-
- UpdateCustomPolicyAfterPlayed();
- return NS_OK;
-}
-
HTMLMediaElement::WakeLockBoolWrapper&
HTMLMediaElement::WakeLockBoolWrapper::operator=(bool val)
{
if (mValue == val) {
return *this;
}
mValue = val;
--- a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl
@@ -60,17 +60,16 @@ interface nsIDOMHTMLMediaElement : nsISu
attribute double playbackRate;
attribute boolean mozPreservesPitch;
readonly attribute nsIDOMTimeRanges played;
readonly attribute nsIDOMTimeRanges seekable;
readonly attribute boolean ended;
readonly attribute boolean mozAutoplayEnabled;
attribute boolean autoplay;
attribute boolean loop;
- void play();
void pause();
// controls
attribute boolean controls;
attribute double volume;
attribute boolean muted;
attribute boolean defaultMuted;