Bug 1910807 - Use videoJS wrapper for Arte PiP captions. r=kpatenio

Differential Revision: https://phabricator.services.mozilla.com/D220837
This commit is contained in:
Tom Schuster 2024-09-04 01:02:09 +00:00
parent 253e97cde2
commit 57ad508070
3 changed files with 1 additions and 41 deletions

View File

@ -63,7 +63,7 @@ let AVAILABLE_PIP_OVERRIDES;
arte: {
"https://*.arte.tv/*": {
videoWrapperScriptPath: "video-wrappers/arte.js",
videoWrapperScriptPath: "video-wrappers/videojsWrapper.js",
},
},

View File

@ -29,7 +29,6 @@ FINAL_TARGET_FILES.features["pictureinpicture@mozilla.org"]["lib"] += [
FINAL_TARGET_FILES.features["pictureinpicture@mozilla.org"]["video-wrappers"] += [
"video-wrappers/airmozilla.js",
"video-wrappers/arte.js",
"video-wrappers/bbc.js",
"video-wrappers/canalplus.js",
"video-wrappers/cbc.js",

View File

@ -1,39 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
class PictureInPictureVideoWrapper {
setCaptionContainerObserver(video, updateCaptionsFunction) {
let container = document.querySelector(".avp-captions");
if (container) {
updateCaptionsFunction("");
const callback = function () {
let textNodeList = container.querySelectorAll(".avp-captions-line");
if (!textNodeList.length) {
updateCaptionsFunction("");
return;
}
updateCaptionsFunction(
Array.from(textNodeList, x => x.textContent).join("\n")
);
};
callback([1], null);
this.captionsObserver = new MutationObserver(callback);
this.captionsObserver.observe(container, {
attributes: false,
childList: true,
subtree: true,
});
}
}
removeCaptionContainerObserver() {
this.captionsObserver?.disconnect();
}
}
this.PictureInPictureVideoWrapper = PictureInPictureVideoWrapper;