Bug 1415478 - part2 : allow autoplay for non-audible media content and video without audio content. r=jwwang
Per UX spec, we would allow non-audible media (volume 0, muted, video without audio track) to autoplay. MozReview-Commit-ID: HKUyt5Jt4sH
This commit is contained in:
@@ -670,11 +670,6 @@ void HTMLMediaElement::ReportLoadError(const char* aMsg,
|
||||
aParamCount);
|
||||
}
|
||||
|
||||
static bool IsAutoplayEnabled()
|
||||
{
|
||||
return Preferences::GetBool("media.autoplay.enabled");
|
||||
}
|
||||
|
||||
class HTMLMediaElement::AudioChannelAgentCallback final :
|
||||
public nsIAudioChannelAgentCallback
|
||||
{
|
||||
@@ -2439,7 +2434,8 @@ void HTMLMediaElement::UpdatePreloadAction()
|
||||
PreloadAction nextAction = PRELOAD_UNDEFINED;
|
||||
// If autoplay is set, or we're playing, we should always preload data,
|
||||
// as we'll need it to play.
|
||||
if ((IsAutoplayEnabled() && HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay)) ||
|
||||
if ((AutoplayPolicy::IsMediaElementAllowedToPlay(WrapNotNull(this)) &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay)) ||
|
||||
!mPaused)
|
||||
{
|
||||
nextAction = HTMLMediaElement::PRELOAD_ENOUGH;
|
||||
@@ -6192,7 +6188,7 @@ bool HTMLMediaElement::CanActivateAutoplay()
|
||||
// download is controlled by the script and there is no way to evaluate
|
||||
// MediaDecoder::CanPlayThrough().
|
||||
|
||||
if (!IsAutoplayEnabled()) {
|
||||
if (!AutoplayPolicy::IsMediaElementAllowedToPlay(WrapNotNull(this))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user