Bug 1835638 - fix play/pause and mute btns sync on Udemy site inside PIP r=pip-reviewers,kpatenio

Differential Revision: https://phabricator.services.mozilla.com/D180917
This commit is contained in:
Janvi Bajoria 2023-08-11 15:29:52 +00:00
Родитель b2160e6a33
Коммит e56c50d203
1 изменённых файлов: 27 добавлений и 0 удалений

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

@ -5,6 +5,33 @@
"use strict";
class PictureInPictureVideoWrapper {
play(video) {
let playPauseButton = document.querySelector(
`[data-purpose="play-button"]`
);
if (video.paused) {
playPauseButton?.click();
}
}
pause(video) {
let playPauseButton = document.querySelector(
`[data-purpose="pause-button"]`
);
if (!video.paused) {
playPauseButton?.click();
}
}
setMuted(video, shouldMute) {
let muteButton = document.querySelector(
`[data-purpose="volume-control-button"]`
);
if (video.muted !== shouldMute && muteButton) {
muteButton.click();
}
}
setCaptionContainerObserver(video, updateCaptionsFunction) {
let container = document.querySelector(
".video-player--video-player--1sfof"