Bug 1284350. Reland on top of backouts "Bug 1282710 - Part 1 - implement the suspend and resume logics in HTMLMediaElement.cpp according to visibility events; r=cpearce r=kamidphish" r=kaku
Instead of "not visible", "approximately visible", and "visible" (in display port) we now have "approximately not visible", and "approximately visible" which includes "visible".
This commit is contained in:
@@ -6017,6 +6017,48 @@ HTMLMediaElement::IsAllowedToPlay()
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char* VisibilityString(Visibility aVisibility) {
|
||||
switch(aVisibility) {
|
||||
case Visibility::UNTRACKED: {
|
||||
return "UNTRACKED";
|
||||
}
|
||||
case Visibility::APPROXIMATELY_NONVISIBLE: {
|
||||
return "APPROXIMATELY_NONVISIBLE";
|
||||
}
|
||||
case Visibility::APPROXIMATELY_VISIBLE: {
|
||||
return "APPROXIMATELY_VISIBLE";
|
||||
}
|
||||
}
|
||||
|
||||
return "NAN";
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::OnVisibilityChange(Visibility aNewVisibility)
|
||||
{
|
||||
LOG(LogLevel::Debug, ("OnVisibilityChange(): %s\n",
|
||||
VisibilityString(aNewVisibility)));
|
||||
|
||||
if (!mDecoder) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aNewVisibility) {
|
||||
case Visibility::UNTRACKED: {
|
||||
MOZ_ASSERT_UNREACHABLE("Shouldn't notify for untracked visibility");
|
||||
break;
|
||||
}
|
||||
case Visibility::APPROXIMATELY_NONVISIBLE: {
|
||||
mDecoder->NotifyOwnerActivityChanged(false);
|
||||
break;
|
||||
}
|
||||
case Visibility::APPROXIMATELY_VISIBLE: {
|
||||
mDecoder->NotifyOwnerActivityChanged(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef MOZ_EME
|
||||
MediaKeys*
|
||||
HTMLMediaElement::GetMediaKeys() const
|
||||
|
||||
Reference in New Issue
Block a user