Bug 1593843 - part10 : ask for the play permission when creating media element. r=bryce

For media element, as the spec requires that we should know the whether it can be allowed to play when we call `media.play()` [1], which means that we should get the result before the play invocation.

Therefore, we request for the play permission when we create media element.

Differential Revision: https://phabricator.services.mozilla.com/D52438

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2019-11-22 21:27:09 +00:00
parent abcee0761a
commit 6d90addd24

View File

@ -19,6 +19,7 @@
#include "DecoderTraits.h"
#include "FrameStatistics.h"
#include "GMPCrashHelper.h"
#include "GVAutoplayPermissionRequest.h"
#ifdef MOZ_ANDROID_HLS_SUPPORT
# include "HLSDecoder.h"
#endif
@ -4051,6 +4052,11 @@ void HTMLMediaElement::Init() {
// in JS)
MediaShutdownManager::InitStatics();
#if defined(MOZ_WIDGET_ANDROID)
GVAutoplayPermissionRequestor::AskForPermissionIfNeeded(
OwnerDoc()->GetInnerWindow());
#endif
mShutdownObserver->Subscribe(this);
mInitialized = true;
}