mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1768818 - More robust way to find subtitles on Netflix. r=pip-reviewers,mhowell
Differential Revision: https://phabricator.services.mozilla.com/D146093
This commit is contained in:
parent
99809832ac
commit
0013e6295f
@ -36,17 +36,8 @@ class PictureInPictureVideoWrapper {
|
||||
if (container) {
|
||||
updateCaptionsFunction("");
|
||||
const callback = function(mutationsList, observer) {
|
||||
let textNodeList = container
|
||||
.querySelector(".player-timedtext")
|
||||
?.querySelectorAll("span > span");
|
||||
if (!textNodeList || textNodeList.length < 1) {
|
||||
updateCaptionsFunction("");
|
||||
return;
|
||||
}
|
||||
|
||||
updateCaptionsFunction(
|
||||
Array.from(textNodeList, x => x.textContent).join("\n")
|
||||
);
|
||||
let text = container.querySelector(".player-timedtext").innerText;
|
||||
updateCaptionsFunction(text);
|
||||
};
|
||||
|
||||
// immediately invoke the callback function to add subtitles to the PiP window
|
||||
|
Loading…
Reference in New Issue
Block a user