Bug 1621166 - part2 : do not stop media control for media being used in PIP mode. r=MeFisto94

The media element being used in the PIP mode would always display on the screen even if the the tab it belongs to is in the background, so users would have high chance to interact with it again. Therefore, we don't want to start a stop-timer to cancel media control for that element.

Differential Revision: https://phabricator.services.mozilla.com/D67381
This commit is contained in:
alwu
2020-03-19 18:15:33 +00:00
parent 03d2cd3600
commit a7053a41e9
2 changed files with 16 additions and 0 deletions

View File

@@ -7763,6 +7763,20 @@ void HTMLMediaElement::CreateStopMediaControlTimerIfNeeded() {
!mMediaControlEventListener->IsStarted()) {
return;
}
// As the media element being used in the PIP mode would always display on the
// screen, users would have high chance to interact with it again, so we don't
// want to stop media control.
if (IsBeingUsedInPictureInPictureMode()) {
MEDIACONTROL_LOG("No need to create a timer for PIP video.");
return;
}
if (!Paused()) {
MEDIACONTROL_LOG("No need to create a timer for playing media.");
return;
}
MEDIACONTROL_LOG("Start stop media control timer");
NS_NewTimerWithFuncCallback(
getter_AddRefs(mStopMediaControlTimer), StopMediaControlTimerCallback,