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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2020-03-19 18:15:33 +00:00
Родитель 86fbf04461
Коммит 7db6ce8171
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -7763,6 +7763,20 @@ void HTMLMediaElement::CreateStopMediaControlTimerIfNeeded() {
!mMediaControlEventListener->IsStarted()) { !mMediaControlEventListener->IsStarted()) {
return; 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"); MEDIACONTROL_LOG("Start stop media control timer");
NS_NewTimerWithFuncCallback( NS_NewTimerWithFuncCallback(
getter_AddRefs(mStopMediaControlTimer), StopMediaControlTimerCallback, getter_AddRefs(mStopMediaControlTimer), StopMediaControlTimerCallback,

Просмотреть файл

@ -582,6 +582,8 @@ void HTMLVideoElement::EndCloningVisually() {
Unused << mVisualCloneTarget->SetVisualCloneSource(nullptr); Unused << mVisualCloneTarget->SetVisualCloneSource(nullptr);
Unused << SetVisualCloneTarget(nullptr); Unused << SetVisualCloneTarget(nullptr);
CreateStopMediaControlTimerIfNeeded();
if (IsInComposedDoc() && !StaticPrefs::media_cloneElementVisually_testing()) { if (IsInComposedDoc() && !StaticPrefs::media_cloneElementVisually_testing()) {
NotifyUAWidgetSetupOrChange(); NotifyUAWidgetSetupOrChange();
} }