/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* 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/. */ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { ContentDOMReference: "resource://gre/modules/ContentDOMReference.sys.mjs", DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs", KEYBOARD_CONTROLS: "resource://gre/modules/PictureInPictureControls.sys.mjs", Rect: "resource://gre/modules/Geometry.sys.mjs", TOGGLE_POLICIES: "resource://gre/modules/PictureInPictureControls.sys.mjs", TOGGLE_POLICY_STRINGS: "resource://gre/modules/PictureInPictureControls.sys.mjs", }); const { WebVTT } = ChromeUtils.import("resource://gre/modules/vtt.jsm"); import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; XPCOMUtils.defineLazyModuleGetters(lazy, { NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm", }); XPCOMUtils.defineLazyPreferenceGetter( lazy, "DISPLAY_TEXT_TRACKS_PREF", "media.videocontrols.picture-in-picture.display-text-tracks.enabled", false ); const TOGGLE_ENABLED_PREF = "media.videocontrols.picture-in-picture.video-toggle.enabled"; const PIP_ENABLED_PREF = "media.videocontrols.picture-in-picture.enabled"; const TOGGLE_TESTING_PREF = "media.videocontrols.picture-in-picture.video-toggle.testing"; const TOGGLE_VISIBILITY_THRESHOLD_PREF = "media.videocontrols.picture-in-picture.video-toggle.visibility-threshold"; const TEXT_TRACK_FONT_SIZE = "media.videocontrols.picture-in-picture.display-text-tracks.size"; const MOUSEMOVE_PROCESSING_DELAY_MS = 50; const TOGGLE_HIDING_TIMEOUT_MS = 2000; // If you change this, also change VideoControlsWidget.SEEK_TIME_SECS: const SEEK_TIME_SECS = 5; const EMPTIED_TIMEOUT_MS = 1000; // The ToggleChild does not want to capture events from the PiP // windows themselves. This set contains all currently open PiP // players' content windows var gPlayerContents = new WeakSet(); // To make it easier to write tests, we have a process-global // WeakSet of all