@mattebox/player 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/mattebox-player.min.js +3 -3
- package/dist/controls/chapters.d.ts +2 -8
- package/dist/controls/chapters.d.ts.map +1 -1
- package/dist/controls/chapters.js +1 -1
- package/dist/controls/chapters.js.map +1 -1
- package/dist/controls/cues.d.ts.map +1 -1
- package/dist/controls/cues.js +2 -2
- package/dist/controls/cues.js.map +1 -1
- package/dist/controls/icons.d.ts +1 -1
- package/dist/controls/icons.d.ts.map +1 -1
- package/dist/controls/icons.js +2 -0
- package/dist/controls/icons.js.map +1 -1
- package/dist/controls/native-tracks.js +1 -1
- package/dist/controls/native-tracks.js.map +1 -1
- package/dist/element-entry.d.ts +1 -0
- package/dist/element-entry.d.ts.map +1 -1
- package/dist/element-entry.js.map +1 -1
- package/dist/element.d.ts +68 -5
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +242 -42
- package/dist/element.js.map +1 -1
- package/dist/elements/airplay-button.js +1 -1
- package/dist/elements/airplay-button.js.map +1 -1
- package/dist/elements/audio-menu.d.ts.map +1 -1
- package/dist/elements/audio-menu.js +4 -3
- package/dist/elements/audio-menu.js.map +1 -1
- package/dist/elements/casting.d.ts +15 -0
- package/dist/elements/casting.d.ts.map +1 -0
- package/dist/elements/casting.js +55 -0
- package/dist/elements/casting.js.map +1 -0
- package/dist/elements/chapters-menu.js +5 -5
- package/dist/elements/chapters-menu.js.map +1 -1
- package/dist/elements/component.d.ts +13 -0
- package/dist/elements/component.d.ts.map +1 -1
- package/dist/elements/component.js +21 -3
- package/dist/elements/component.js.map +1 -1
- package/dist/elements/control-bar.d.ts +16 -2
- package/dist/elements/control-bar.d.ts.map +1 -1
- package/dist/elements/control-bar.js +29 -7
- package/dist/elements/control-bar.js.map +1 -1
- package/dist/elements/current-time.js +2 -2
- package/dist/elements/current-time.js.map +1 -1
- package/dist/elements/drm-badge.js +2 -2
- package/dist/elements/drm-badge.js.map +1 -1
- package/dist/elements/duration.js +3 -3
- package/dist/elements/duration.js.map +1 -1
- package/dist/elements/error-screen.js +2 -2
- package/dist/elements/error-screen.js.map +1 -1
- package/dist/elements/fullscreen-button.d.ts.map +1 -1
- package/dist/elements/fullscreen-button.js +3 -2
- package/dist/elements/fullscreen-button.js.map +1 -1
- package/dist/elements/live-button.js +3 -3
- package/dist/elements/live-button.js.map +1 -1
- package/dist/elements/marker-button.js +3 -3
- package/dist/elements/marker-button.js.map +1 -1
- package/dist/elements/menu-element.js +3 -3
- package/dist/elements/menu-element.js.map +1 -1
- package/dist/elements/mute-button.js +3 -3
- package/dist/elements/mute-button.js.map +1 -1
- package/dist/elements/pip-button.d.ts.map +1 -1
- package/dist/elements/pip-button.js +6 -2
- package/dist/elements/pip-button.js.map +1 -1
- package/dist/elements/play-button.js +3 -3
- package/dist/elements/play-button.js.map +1 -1
- package/dist/elements/quality-menu.d.ts.map +1 -1
- package/dist/elements/quality-menu.js +5 -4
- package/dist/elements/quality-menu.js.map +1 -1
- package/dist/elements/remaining-time.js +2 -2
- package/dist/elements/remaining-time.js.map +1 -1
- package/dist/elements/scan-button.d.ts.map +1 -1
- package/dist/elements/scan-button.js +4 -3
- package/dist/elements/scan-button.js.map +1 -1
- package/dist/elements/seek-bar.d.ts.map +1 -1
- package/dist/elements/seek-bar.js +20 -16
- package/dist/elements/seek-bar.js.map +1 -1
- package/dist/elements/shared.js +4 -4
- package/dist/elements/shared.js.map +1 -1
- package/dist/elements/skip-button.js +2 -2
- package/dist/elements/skip-button.js.map +1 -1
- package/dist/elements/spacer.js.map +1 -1
- package/dist/elements/speed-menu.d.ts.map +1 -1
- package/dist/elements/speed-menu.js +4 -3
- package/dist/elements/speed-menu.js.map +1 -1
- package/dist/elements/spinner.js +1 -1
- package/dist/elements/spinner.js.map +1 -1
- package/dist/elements/start-button.js +3 -3
- package/dist/elements/start-button.js.map +1 -1
- package/dist/elements/subtitles-menu.d.ts.map +1 -1
- package/dist/elements/subtitles-menu.js +34 -10
- package/dist/elements/subtitles-menu.js.map +1 -1
- package/dist/elements/time-element.js +1 -1
- package/dist/elements/time-element.js.map +1 -1
- package/dist/elements/title.js +1 -1
- package/dist/elements/title.js.map +1 -1
- package/dist/elements/video-menu.d.ts.map +1 -1
- package/dist/elements/video-menu.js +5 -4
- package/dist/elements/video-menu.js.map +1 -1
- package/dist/elements/volume-slider.js +4 -4
- package/dist/elements/volume-slider.js.map +1 -1
- package/dist/elements/volume.js.map +1 -1
- package/dist/entries/airplay-button.js +1 -1
- package/dist/entries/audio-menu.js +1 -1
- package/dist/entries/casting.d.ts +5 -0
- package/dist/entries/casting.d.ts.map +1 -0
- package/dist/entries/casting.js +8 -0
- package/dist/entries/casting.js.map +1 -0
- package/dist/entries/chapters-menu.js +1 -1
- package/dist/entries/control-bar.js +1 -1
- package/dist/entries/current-time.js +1 -1
- package/dist/entries/drm-badge.js +1 -1
- package/dist/entries/duration.js +1 -1
- package/dist/entries/error-screen.js +1 -1
- package/dist/entries/fullscreen-button.js +1 -1
- package/dist/entries/live-button.js +1 -1
- package/dist/entries/marker-button.js +1 -1
- package/dist/entries/mute-button.js +1 -1
- package/dist/entries/pip-button.js +1 -1
- package/dist/entries/play-button.js +1 -1
- package/dist/entries/quality-menu.js +1 -1
- package/dist/entries/remaining-time.js +1 -1
- package/dist/entries/scan-button.js +1 -1
- package/dist/entries/seek-bar.js +1 -1
- package/dist/entries/skip-button.js +1 -1
- package/dist/entries/spacer.js +1 -1
- package/dist/entries/speed-menu.js +1 -1
- package/dist/entries/spinner.js +1 -1
- package/dist/entries/start-button.js +1 -1
- package/dist/entries/subtitles-menu.js +1 -1
- package/dist/entries/title.js +1 -1
- package/dist/entries/video-menu.js +1 -1
- package/dist/entries/volume-slider.js +1 -1
- package/dist/entries/volume.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.js +13 -0
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/controls/chapters.js +2 -2
- package/dist/es2015/controls/cues.js +2 -2
- package/dist/es2015/controls/icons.js +2 -0
- package/dist/es2015/controls/menu.js +1 -1
- package/dist/es2015/controls/native-tracks.js +1 -1
- package/dist/es2015/element.js +262 -55
- package/dist/es2015/elements/airplay-button.js +1 -1
- package/dist/es2015/elements/audio-menu.js +4 -3
- package/dist/es2015/elements/casting.js +55 -0
- package/dist/es2015/elements/chapters-menu.js +5 -5
- package/dist/es2015/elements/component.js +26 -7
- package/dist/es2015/elements/control-bar.js +29 -7
- package/dist/es2015/elements/current-time.js +2 -2
- package/dist/es2015/elements/drm-badge.js +2 -2
- package/dist/es2015/elements/duration.js +3 -3
- package/dist/es2015/elements/error-screen.js +2 -2
- package/dist/es2015/elements/fullscreen-button.js +3 -2
- package/dist/es2015/elements/live-button.js +3 -3
- package/dist/es2015/elements/marker-button.js +3 -3
- package/dist/es2015/elements/menu-element.js +4 -4
- package/dist/es2015/elements/mute-button.js +3 -3
- package/dist/es2015/elements/pip-button.js +6 -2
- package/dist/es2015/elements/play-button.js +3 -3
- package/dist/es2015/elements/quality-menu.js +5 -4
- package/dist/es2015/elements/remaining-time.js +2 -2
- package/dist/es2015/elements/scan-button.js +4 -3
- package/dist/es2015/elements/seek-bar.js +20 -16
- package/dist/es2015/elements/shared.js +4 -4
- package/dist/es2015/elements/skip-button.js +2 -2
- package/dist/es2015/elements/speed-menu.js +4 -3
- package/dist/es2015/elements/spinner.js +1 -1
- package/dist/es2015/elements/start-button.js +3 -3
- package/dist/es2015/elements/subtitles-menu.js +34 -10
- package/dist/es2015/elements/time-element.js +1 -1
- package/dist/es2015/elements/title.js +1 -1
- package/dist/es2015/elements/video-menu.js +5 -4
- package/dist/es2015/elements/volume-slider.js +4 -4
- package/dist/es2015/entries/airplay-button.js +1 -1
- package/dist/es2015/entries/audio-menu.js +1 -1
- package/dist/es2015/entries/casting.js +6 -0
- package/dist/es2015/entries/chapters-menu.js +1 -1
- package/dist/es2015/entries/control-bar.js +1 -1
- package/dist/es2015/entries/current-time.js +1 -1
- package/dist/es2015/entries/drm-badge.js +1 -1
- package/dist/es2015/entries/duration.js +1 -1
- package/dist/es2015/entries/error-screen.js +1 -1
- package/dist/es2015/entries/fullscreen-button.js +1 -1
- package/dist/es2015/entries/live-button.js +1 -1
- package/dist/es2015/entries/marker-button.js +1 -1
- package/dist/es2015/entries/mute-button.js +1 -1
- package/dist/es2015/entries/pip-button.js +1 -1
- package/dist/es2015/entries/play-button.js +1 -1
- package/dist/es2015/entries/quality-menu.js +1 -1
- package/dist/es2015/entries/remaining-time.js +1 -1
- package/dist/es2015/entries/scan-button.js +1 -1
- package/dist/es2015/entries/seek-bar.js +1 -1
- package/dist/es2015/entries/skip-button.js +1 -1
- package/dist/es2015/entries/spacer.js +1 -1
- package/dist/es2015/entries/speed-menu.js +1 -1
- package/dist/es2015/entries/spinner.js +1 -1
- package/dist/es2015/entries/start-button.js +1 -1
- package/dist/es2015/entries/subtitles-menu.js +1 -1
- package/dist/es2015/entries/title.js +1 -1
- package/dist/es2015/entries/video-menu.js +1 -1
- package/dist/es2015/entries/volume-slider.js +1 -1
- package/dist/es2015/entries/volume.js +1 -1
- package/dist/es2015/host.js +9 -1
- package/dist/es2015/index.js +5 -3
- package/dist/es2015/locales/ar.js +4 -1
- package/dist/es2015/locales/ca.js +4 -1
- package/dist/es2015/locales/de.js +4 -1
- package/dist/es2015/locales/es.js +4 -1
- package/dist/es2015/locales/fr.js +4 -1
- package/dist/es2015/locales/hi.js +4 -1
- package/dist/es2015/locales/it.js +4 -1
- package/dist/es2015/locales/ja.js +4 -1
- package/dist/es2015/locales/ko.js +4 -1
- package/dist/es2015/locales/pt.js +4 -1
- package/dist/es2015/locales/zh.js +4 -1
- package/dist/es2015/locales.js +1 -1
- package/dist/es2015/media.js +136 -0
- package/dist/es2015/presets.js +3 -2
- package/dist/es2015/style.js +1 -1
- package/dist/es2015/tags.js +2 -1
- package/dist/es2015/video-sources.js +1 -1
- package/dist/host.d.ts +32 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +9 -1
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/locales/ar.d.ts +3 -0
- package/dist/locales/ar.d.ts.map +1 -1
- package/dist/locales/ar.js +4 -1
- package/dist/locales/ar.js.map +1 -1
- package/dist/locales/ca.d.ts +3 -0
- package/dist/locales/ca.d.ts.map +1 -1
- package/dist/locales/ca.js +4 -1
- package/dist/locales/ca.js.map +1 -1
- package/dist/locales/de.d.ts +3 -0
- package/dist/locales/de.d.ts.map +1 -1
- package/dist/locales/de.js +4 -1
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/es.d.ts +3 -0
- package/dist/locales/es.d.ts.map +1 -1
- package/dist/locales/es.js +4 -1
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.d.ts +3 -0
- package/dist/locales/fr.d.ts.map +1 -1
- package/dist/locales/fr.js +4 -1
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/hi.d.ts +3 -0
- package/dist/locales/hi.d.ts.map +1 -1
- package/dist/locales/hi.js +4 -1
- package/dist/locales/hi.js.map +1 -1
- package/dist/locales/it.d.ts +3 -0
- package/dist/locales/it.d.ts.map +1 -1
- package/dist/locales/it.js +4 -1
- package/dist/locales/it.js.map +1 -1
- package/dist/locales/ja.d.ts +3 -0
- package/dist/locales/ja.d.ts.map +1 -1
- package/dist/locales/ja.js +4 -1
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.d.ts +3 -0
- package/dist/locales/ko.d.ts.map +1 -1
- package/dist/locales/ko.js +4 -1
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/pt.d.ts +3 -0
- package/dist/locales/pt.d.ts.map +1 -1
- package/dist/locales/pt.js +4 -1
- package/dist/locales/pt.js.map +1 -1
- package/dist/locales/zh.d.ts +3 -0
- package/dist/locales/zh.d.ts.map +1 -1
- package/dist/locales/zh.js +4 -1
- package/dist/locales/zh.js.map +1 -1
- package/dist/media.d.ts +22 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +136 -0
- package/dist/media.js.map +1 -0
- package/dist/messages.d.ts +6 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/presets.js +2 -1
- package/dist/presets.js.map +1 -1
- package/dist/remote.d.ts +80 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/dist/tags.d.ts +1 -0
- package/dist/tags.d.ts.map +1 -1
- package/dist/tags.js +2 -1
- package/dist/tags.js.map +1 -1
- package/package.json +3 -3
- package/dist/es2015/_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/toPrimitive.js +0 -13
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { icon } from "../controls/icons.js";
|
|
2
|
+
import { el } from "../dom.js";
|
|
3
|
+
import { fill } from "../labels.js";
|
|
4
|
+
import { Component } from "./component.js";
|
|
5
|
+
import { style } from "./shared.js";
|
|
6
|
+
// src/elements/casting.ts
|
|
7
|
+
const STYLE = ":host{color:var(--mbx-text);font-family:var(--mbx-font);pointer-events:none;background:#000;justify-content:center;align-items:center;display:none;position:absolute;top:0;bottom:0;left:0;right:0}:host([casting]){display:flex}:host([hidden]){display:none}[part~=poster]{object-fit:contain;opacity:.35;width:100%;height:100%;position:absolute;top:0;left:0}[part~=device]{max-width:100%;padding:0 var(--mbx-pad) var(--mbx-bar-rows,0px);text-align:center;text-shadow:0 1px 3px #0009;flex-direction:column;align-items:center;display:flex;position:relative}[part~=icon]{fill:currentColor;filter:drop-shadow(0 1px 3px #0009);width:3.5em;height:3.5em;margin-bottom:.6em}[part~=label]{font-size:1.25em;font-weight:600;line-height:1.3}:host([layout=compact]) [part~=icon]{width:2.5em;height:2.5em;margin-bottom:.4em}:host([layout=compact]) [part~=label]{font-size:1em}";
|
|
8
|
+
var MbxCasting = class extends Component {
|
|
9
|
+
static get observedAttributes() {
|
|
10
|
+
return ["label"];
|
|
11
|
+
}
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
const root = this.attachShadow({ mode: "open" });
|
|
15
|
+
this.poster = el("img", "poster");
|
|
16
|
+
this.poster.alt = "";
|
|
17
|
+
this.poster.hidden = true;
|
|
18
|
+
this.device = el("div", "device");
|
|
19
|
+
this.label = el("div", "label");
|
|
20
|
+
this.label.setAttribute("role", "status");
|
|
21
|
+
this.device.append(this.label);
|
|
22
|
+
this.glyph = null;
|
|
23
|
+
root.append(style(STYLE), this.poster, this.device);
|
|
24
|
+
}
|
|
25
|
+
attach(player) {
|
|
26
|
+
this.listen(player, ["programmechange"], () => {
|
|
27
|
+
this.render();
|
|
28
|
+
});
|
|
29
|
+
this.render();
|
|
30
|
+
}
|
|
31
|
+
detach() {
|
|
32
|
+
this.removeAttribute("casting");
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
var _player$casting, _player$programme, _ref, _metadata$poster;
|
|
36
|
+
const player = this.player;
|
|
37
|
+
const target = (_player$casting = player === null || player === void 0 ? void 0 : player.casting) !== null && _player$casting !== void 0 ? _player$casting : null;
|
|
38
|
+
if (target === null) this.removeAttribute("casting");
|
|
39
|
+
else this.setAttribute("casting", target.kind);
|
|
40
|
+
if (player === null || target === null) return;
|
|
41
|
+
const metadata = (_player$programme = player.programme) === null || _player$programme === void 0 ? void 0 : _player$programme.metadata;
|
|
42
|
+
const poster = (_ref = (_metadata$poster = metadata === null || metadata === void 0 ? void 0 : metadata.poster) !== null && _metadata$poster !== void 0 ? _metadata$poster : metadata === null || metadata === void 0 ? void 0 : metadata.image) !== null && _ref !== void 0 ? _ref : player.getAttribute("poster");
|
|
43
|
+
this.poster.hidden = poster === null || poster === void 0;
|
|
44
|
+
if (poster !== null && poster !== void 0 && this.poster.getAttribute("src") !== poster) this.poster.src = poster;
|
|
45
|
+
const glyph = target.kind === "airplay" ? "airplay-active" : "cast";
|
|
46
|
+
if (glyph !== this.glyph) {
|
|
47
|
+
var _this$device$querySel;
|
|
48
|
+
this.glyph = glyph;
|
|
49
|
+
(_this$device$querySel = this.device.querySelector("svg")) === null || _this$device$querySel === void 0 || _this$device$querySel.remove();
|
|
50
|
+
this.device.insertBefore(icon(glyph), this.label);
|
|
51
|
+
}
|
|
52
|
+
this.label.textContent = target.name === "" ? target.kind === "airplay" ? this.word("label", "airplay", "AirPlay") : "" : fill(this.word("label", "castingTo", "Casting to {device}"), { device: target.name });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export { MbxCasting };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { show } from "./shared.js";
|
|
2
|
-
import { MenuElement, single } from "./menu-element.js";
|
|
3
|
-
import { format } from "../controls/time.js";
|
|
4
1
|
import { chapterAt, chapters, followChapters } from "../controls/chapters.js";
|
|
2
|
+
import { format } from "../controls/time.js";
|
|
3
|
+
import { MenuElement, single } from "./menu-element.js";
|
|
4
|
+
import { show } from "./shared.js";
|
|
5
5
|
// src/elements/chapters-menu.ts
|
|
6
6
|
/**
|
|
7
7
|
* <mbx-chapters-menu>: the chapters of the video as a list, each with its
|
|
@@ -30,7 +30,7 @@ var MbxChaptersMenu = class extends MenuElement {
|
|
|
30
30
|
this.render();
|
|
31
31
|
};
|
|
32
32
|
this.keep(followChapters(player, tick));
|
|
33
|
-
this.listen(player.
|
|
33
|
+
this.listen(player.media, [
|
|
34
34
|
"timeupdate",
|
|
35
35
|
"seeked",
|
|
36
36
|
"emptied",
|
|
@@ -42,7 +42,7 @@ var MbxChaptersMenu = class extends MenuElement {
|
|
|
42
42
|
render() {
|
|
43
43
|
var _this$player, _this$player$engine, _this$player2;
|
|
44
44
|
super.render();
|
|
45
|
-
const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.
|
|
45
|
+
const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.media;
|
|
46
46
|
if (video === void 0) return;
|
|
47
47
|
const list = chapters(video, (_this$player$engine = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.engine) !== null && _this$player$engine !== void 0 ? _this$player$engine : null);
|
|
48
48
|
this.hidden = list.length === 0;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { findPlayer } from "../host.js";
|
|
1
2
|
import { PLAYER } from "../tags.js";
|
|
2
3
|
import { textIn } from "../text.js";
|
|
3
|
-
import { findPlayer } from "../host.js";
|
|
4
4
|
// src/elements/component.ts
|
|
5
5
|
var Component = class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
8
|
this.player = null;
|
|
9
|
+
this.leaves = null;
|
|
9
10
|
this.offs = [];
|
|
10
11
|
this.epoch = 0;
|
|
11
12
|
}
|
|
@@ -17,7 +18,7 @@ var Component = class extends HTMLElement {
|
|
|
17
18
|
const attach = () => {
|
|
18
19
|
if (epoch !== this.epoch || !this.isConnected) return;
|
|
19
20
|
customElements.upgrade(found);
|
|
20
|
-
if (!("
|
|
21
|
+
if (!("media" in found)) return;
|
|
21
22
|
this.player = found;
|
|
22
23
|
const tier = () => {
|
|
23
24
|
const layout = found.getAttribute("layout");
|
|
@@ -31,10 +32,19 @@ var Component = class extends HTMLElement {
|
|
|
31
32
|
this.listen(found, ["localechange"], () => {
|
|
32
33
|
this.render();
|
|
33
34
|
});
|
|
35
|
+
const cast = () => {
|
|
36
|
+
const gone = this.leaves !== null && found.hasAttribute("casting") && (this.leaves === "device" || this.remote());
|
|
37
|
+
this.toggleAttribute("away", gone);
|
|
38
|
+
};
|
|
39
|
+
this.listen(found, ["castingchange"], () => {
|
|
40
|
+
cast();
|
|
41
|
+
this.render();
|
|
42
|
+
});
|
|
34
43
|
tier();
|
|
44
|
+
cast();
|
|
35
45
|
this.attach(this.player);
|
|
36
46
|
};
|
|
37
|
-
if ("
|
|
47
|
+
if ("media" in found) attach();
|
|
38
48
|
else customElements.whenDefined(PLAYER).then(attach);
|
|
39
49
|
}
|
|
40
50
|
disconnectedCallback() {
|
|
@@ -57,17 +67,26 @@ var Component = class extends HTMLElement {
|
|
|
57
67
|
});
|
|
58
68
|
}
|
|
59
69
|
/**
|
|
70
|
+
* Whether a device plays that is not the video itself. Under AirPlay the
|
|
71
|
+
* video still plays the source and answers every member.
|
|
72
|
+
*/
|
|
73
|
+
remote() {
|
|
74
|
+
var _this$player$casting, _this$player;
|
|
75
|
+
const target = (_this$player$casting = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.casting) !== null && _this$player$casting !== void 0 ? _this$player$casting : null;
|
|
76
|
+
return target !== null && target.kind !== "airplay";
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
60
79
|
* A word the control shows: its `attribute` when the page set one, else
|
|
61
80
|
* the player's language's `id`, else `english`.
|
|
62
81
|
*/
|
|
63
82
|
word(attribute, id, english) {
|
|
64
|
-
var _ref, _this$getAttribute, _this$
|
|
65
|
-
return (_ref = (_this$getAttribute = this.getAttribute(attribute)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : (_this$
|
|
83
|
+
var _ref, _this$getAttribute, _this$player2;
|
|
84
|
+
return (_ref = (_this$getAttribute = this.getAttribute(attribute)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.message(id)) !== null && _ref !== void 0 ? _ref : english;
|
|
66
85
|
}
|
|
67
86
|
/** Words the page gave, in the player's language. */
|
|
68
87
|
pageText(text) {
|
|
69
|
-
var _this$player$locale, _this$
|
|
70
|
-
return textIn(text, (_this$player$locale = (_this$
|
|
88
|
+
var _this$player$locale, _this$player3;
|
|
89
|
+
return textIn(text, (_this$player$locale = (_this$player3 = this.player) === null || _this$player3 === void 0 ? void 0 : _this$player3.locale) !== null && _this$player$locale !== void 0 ? _this$player$locale : "");
|
|
71
90
|
}
|
|
72
91
|
/** Keeps `off` to run on detach. */
|
|
73
92
|
keep(off) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { cueLift, cueStyle } from "../controls/cues.js";
|
|
2
|
+
import { fullscreen } from "../controls/fullscreen.js";
|
|
3
|
+
import { videoOf } from "../host.js";
|
|
1
4
|
import { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, DRM_BADGE, MUTE_BUTTON, PIP_BUTTON, QUALITY_MENU, SCAN_BUTTON, SKIP_BUTTON, SPEED_MENU, SUBTITLES_MENU, VIDEO_MENU, VOLUME, VOLUME_SLIDER } from "../tags.js";
|
|
2
5
|
import { Component } from "./component.js";
|
|
3
6
|
import { number, shownPaused, style } from "./shared.js";
|
|
4
|
-
import { cueLift, cueStyle } from "../controls/cues.js";
|
|
5
|
-
import { fullscreen } from "../controls/fullscreen.js";
|
|
6
7
|
// src/elements/control-bar.ts
|
|
7
8
|
const STYLE = ":host{box-sizing:border-box;color:var(--mbx-text);font:500 1em / 1.2 var(--mbx-font);background:linear-gradient(#0000,#0009);flex-direction:column;padding:2.5em 1em .75em;transition:opacity .2s;display:flex;position:absolute;bottom:0;left:0;right:0}:host([menu]){z-index:2;--mbx-tooltip:none}:host([idle]){opacity:0;pointer-events:none}[part~=row]{align-items:center;margin:0 -.25em;display:flex}[part~=buttons-row]{margin-top:.25em}[part~=seek-row]{margin:0 -.5em}slot:not([name])::slotted(*){margin:0 .25em}slot[name=seek]::slotted(*){margin:0 .5em}::slotted([collapsed]){display:none}@media (prefers-reduced-motion:reduce){:host{transition:none}}:host([layout=compact]){padding:1.5em .5em .25em}";
|
|
8
9
|
const IDLE_MS = 3e3;
|
|
@@ -73,6 +74,8 @@ var MbxControlBar = class extends Component {
|
|
|
73
74
|
super();
|
|
74
75
|
this.timer = void 0;
|
|
75
76
|
this.keyboard = false;
|
|
77
|
+
this.touch = false;
|
|
78
|
+
this.shownAtPress = false;
|
|
76
79
|
this.cues = null;
|
|
77
80
|
this.screen = null;
|
|
78
81
|
this.resizer = null;
|
|
@@ -152,6 +155,7 @@ var MbxControlBar = class extends Component {
|
|
|
152
155
|
}
|
|
153
156
|
held(player) {
|
|
154
157
|
if (shownPaused(player, ["switching"])) return true;
|
|
158
|
+
if (player.hasAttribute("casting")) return true;
|
|
155
159
|
if (this.querySelector("[open]") !== null) return true;
|
|
156
160
|
if (!this.keyboard) return false;
|
|
157
161
|
const active = this.getRootNode().activeElement;
|
|
@@ -172,6 +176,12 @@ var MbxControlBar = class extends Component {
|
|
|
172
176
|
}
|
|
173
177
|
this.idle(player, true);
|
|
174
178
|
}
|
|
179
|
+
/** Hides the bar now, as a tap asks: the next input shows it again. */
|
|
180
|
+
rest(player) {
|
|
181
|
+
clearTimeout(this.timer);
|
|
182
|
+
this.timer = void 0;
|
|
183
|
+
this.idle(player, true);
|
|
184
|
+
}
|
|
175
185
|
wake(player) {
|
|
176
186
|
clearTimeout(this.timer);
|
|
177
187
|
this.idle(player, false);
|
|
@@ -188,14 +198,15 @@ var MbxControlBar = class extends Component {
|
|
|
188
198
|
cancelable: true
|
|
189
199
|
});
|
|
190
200
|
if (!player.dispatchEvent(asked)) return;
|
|
191
|
-
const video = player.
|
|
201
|
+
const video = player.media;
|
|
192
202
|
video.currentTime = Math.min(end(video), Math.max(0, video.currentTime + by));
|
|
193
203
|
}
|
|
194
204
|
key(player, event) {
|
|
195
205
|
this.keyboard = true;
|
|
206
|
+
this.touch = false;
|
|
196
207
|
this.wake(player);
|
|
197
208
|
if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
198
|
-
const video = player.
|
|
209
|
+
const video = player.media;
|
|
199
210
|
const onButton = event.composedPath()[0] instanceof HTMLButtonElement;
|
|
200
211
|
switch (event.key) {
|
|
201
212
|
case " ":
|
|
@@ -238,7 +249,7 @@ var MbxControlBar = class extends Component {
|
|
|
238
249
|
event.preventDefault();
|
|
239
250
|
}
|
|
240
251
|
attach(player) {
|
|
241
|
-
const video = player.
|
|
252
|
+
const video = player.media;
|
|
242
253
|
cueStyle();
|
|
243
254
|
this.cues = cueLift(video, player, () => this.covered());
|
|
244
255
|
const screen = fullscreen(player, video);
|
|
@@ -264,13 +275,24 @@ var MbxControlBar = class extends Component {
|
|
|
264
275
|
this.keyboard = false;
|
|
265
276
|
this.wake(player);
|
|
266
277
|
};
|
|
278
|
+
const press = (event) => {
|
|
279
|
+
this.touch = event.pointerType === "touch";
|
|
280
|
+
this.shownAtPress = !this.hasAttribute("idle");
|
|
281
|
+
pointer();
|
|
282
|
+
};
|
|
267
283
|
const key = (event) => {
|
|
268
284
|
this.key(player, event);
|
|
269
285
|
};
|
|
270
286
|
const click = (event) => {
|
|
271
|
-
if (event.composedPath()[0]
|
|
287
|
+
if (event.composedPath()[0] !== videoOf(player)) return;
|
|
288
|
+
if (this.touch && !this.hasAttribute("tap-plays") && !player.hasAttribute("casting")) {
|
|
289
|
+
if (this.shownAtPress) this.rest(player);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
toggle(video);
|
|
272
293
|
};
|
|
273
|
-
this.listen(player, ["pointermove"
|
|
294
|
+
this.listen(player, ["pointermove"], pointer);
|
|
295
|
+
this.listen(player, ["pointerdown"], press);
|
|
274
296
|
player.addEventListener("keydown", key);
|
|
275
297
|
player.addEventListener("click", click);
|
|
276
298
|
this.keep(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { format } from "../controls/time.js";
|
|
2
1
|
import { live, span, wall } from "../controls/session.js";
|
|
2
|
+
import { format } from "../controls/time.js";
|
|
3
3
|
import { TimeElement } from "./time-element.js";
|
|
4
4
|
// src/elements/current-time.ts
|
|
5
5
|
/**
|
|
@@ -15,7 +15,7 @@ var MbxCurrentTime = class extends TimeElement {
|
|
|
15
15
|
var _wall;
|
|
16
16
|
const player = this.player;
|
|
17
17
|
if (player === null) return;
|
|
18
|
-
const video = player.
|
|
18
|
+
const video = player.media;
|
|
19
19
|
const engine = player.engine;
|
|
20
20
|
const on = live(engine) !== void 0;
|
|
21
21
|
const time = video.currentTime;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { icon } from "../controls/icons.js";
|
|
1
2
|
import { el } from "../dom.js";
|
|
2
3
|
import { fill } from "../labels.js";
|
|
3
4
|
import { namespaces } from "../namespaces.js";
|
|
4
|
-
import { icon } from "../controls/icons.js";
|
|
5
5
|
import { Component } from "./component.js";
|
|
6
6
|
import { style } from "./shared.js";
|
|
7
7
|
// src/elements/drm-badge.ts
|
|
8
|
-
const STYLE = ":host{width:2.5em;height:2.5em;color:var(--mbx-muted);border-radius:var(--mbx-radius);cursor:default;justify-content:center;align-items:center;display:inline-flex;position:relative}:host([hidden]){display:none}:host(:focus){outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}[part~=tooltip]{border-radius:var(--mbx-radius);color:var(--mbx-text);text-align:left;white-space:nowrap;pointer-events:none;background:#1c1c20f2;margin-bottom:.6154em;padding:.6154em .7692em;font-size:.8125em;line-height:1.4;position:absolute;bottom:100%;right:0;box-shadow:0 4px 16px #00000080}[part~=tooltip][hidden]{display:none}[part~=tooltip-title]{font-weight:600}[part~=tooltip-text]{color:var(--mbx-muted)}";
|
|
8
|
+
const STYLE = ":host{width:2.5em;height:2.5em;color:var(--mbx-muted);border-radius:var(--mbx-radius);cursor:default;justify-content:center;align-items:center;display:inline-flex;position:relative}:host([hidden]){display:none}:host(:focus){outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)){outline-style:var(--mbx-focus-ring,none)}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}[part~=tooltip]{border-radius:var(--mbx-radius);color:var(--mbx-text);text-align:left;white-space:nowrap;pointer-events:none;background:#1c1c20f2;margin-bottom:.6154em;padding:.6154em .7692em;font-size:.8125em;line-height:1.4;position:absolute;bottom:100%;right:0;box-shadow:0 4px 16px #00000080}[part~=tooltip][hidden]{display:none}[part~=tooltip-title]{font-weight:600}[part~=tooltip-text]{color:var(--mbx-muted)}";
|
|
9
9
|
/** The name a viewer knows a key system by. */
|
|
10
10
|
function keySystemName(id) {
|
|
11
11
|
if (id.startsWith("com.widevine")) return "Widevine";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { format } from "../controls/time.js";
|
|
2
1
|
import { live, span } from "../controls/session.js";
|
|
2
|
+
import { format } from "../controls/time.js";
|
|
3
3
|
import { TimeElement } from "./time-element.js";
|
|
4
4
|
// src/elements/duration.ts
|
|
5
5
|
/**
|
|
@@ -20,8 +20,8 @@ var MbxDuration = class extends TimeElement {
|
|
|
20
20
|
const on = live(engine) !== void 0;
|
|
21
21
|
this.hidden = on;
|
|
22
22
|
if (on) return;
|
|
23
|
-
const end = span(player.
|
|
24
|
-
this.text.data = this.getAttribute("layout") === "compact" ? `-${format(Math.max(0, end - player.
|
|
23
|
+
const end = span(player.media, engine).end;
|
|
24
|
+
this.text.data = this.getAttribute("layout") === "compact" ? `-${format(Math.max(0, end - player.media.currentTime))}` : format(end);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
export { MbxDuration };
|
|
@@ -2,7 +2,7 @@ import { el } from "../dom.js";
|
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
3
|
import { style } from "./shared.js";
|
|
4
4
|
// src/elements/error-screen.ts
|
|
5
|
-
const STYLE = ":host{color:var(--mbx-text);font:400 .9375em / 1.4 var(--mbx-font);text-align:center;background:#000000bf;justify-content:center;align-items:center;padding:1.0667em;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}:host([hidden]){display:none}[part~=box]{flex-direction:column;align-items:center;display:flex}[part~=box]>:not([hidden])~:not([hidden]){margin-top:.5333em}[part~=title]{font-size:1.2em;font-weight:600}[part~=detail]{color:var(--mbx-error);font-family:monospace;font-size:.8667em}[part~=message]{max-width:32em}[part~=actions]>:not([hidden])~:not([hidden]){margin-left:.5333em}[part~=action]{height:2.4em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 1.0667em;font-weight:600}[part~=action]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=action]:focus:not(:focus-visible){outline:none}";
|
|
5
|
+
const STYLE = ":host{color:var(--mbx-text);font:400 .9375em / 1.4 var(--mbx-font);text-align:center;background:#000000bf;justify-content:center;align-items:center;padding:1.0667em;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}:host([hidden]){display:none}[part~=box]{flex-direction:column;align-items:center;display:flex}[part~=box]>:not([hidden])~:not([hidden]){margin-top:.5333em}[part~=title]{font-size:1.2em;font-weight:600}[part~=detail]{color:var(--mbx-error);font-family:monospace;font-size:.8667em}[part~=message]{max-width:32em}[part~=actions]>:not([hidden])~:not([hidden]){margin-left:.5333em}[part~=action]{height:2.4em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 1.0667em;font-weight:600}[part~=action]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=action]:focus:not(:focus-visible){outline-style:var(--mbx-focus-ring,none)}";
|
|
6
6
|
/** The diagnostics element, another package's, named here as a string. */
|
|
7
7
|
const DIAGNOSTICS = "mbx-diagnostics";
|
|
8
8
|
var MbxErrorScreen = class extends Component {
|
|
@@ -70,7 +70,7 @@ var MbxErrorScreen = class extends Component {
|
|
|
70
70
|
this.keep(() => {
|
|
71
71
|
player.removeEventListener("error", failure);
|
|
72
72
|
});
|
|
73
|
-
this.listen(player.
|
|
73
|
+
this.listen(player.media, ["playing", "loadstart"], () => {
|
|
74
74
|
if (this.block === null) this.hidden = true;
|
|
75
75
|
});
|
|
76
76
|
this.listen(player, ["sourcechange"], () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { fullscreen } from "../controls/fullscreen.js";
|
|
1
2
|
import { icon } from "../controls/icons.js";
|
|
2
3
|
import { Component } from "./component.js";
|
|
3
4
|
import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
|
|
4
|
-
import { fullscreen } from "../controls/fullscreen.js";
|
|
5
5
|
// src/elements/fullscreen-button.ts
|
|
6
6
|
const STATES = ["enter", "exit"];
|
|
7
7
|
var MbxFullscreenButton = class extends Component {
|
|
@@ -10,6 +10,7 @@ var MbxFullscreenButton = class extends Component {
|
|
|
10
10
|
}
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
13
|
+
this.leaves = "device";
|
|
13
14
|
this.api = null;
|
|
14
15
|
const root = this.attachShadow({ mode: "open" });
|
|
15
16
|
this.button = document.createElement("button");
|
|
@@ -24,7 +25,7 @@ var MbxFullscreenButton = class extends Component {
|
|
|
24
25
|
root.append(style(BUTTON_STYLE), this.button);
|
|
25
26
|
}
|
|
26
27
|
attach(player) {
|
|
27
|
-
const api = fullscreen(player, player.
|
|
28
|
+
const api = fullscreen(player, player.media);
|
|
28
29
|
this.api = api;
|
|
29
30
|
this.hidden = !api.supported;
|
|
30
31
|
this.keep(api.watch(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { live } from "../controls/session.js";
|
|
1
2
|
import { el } from "../dom.js";
|
|
2
3
|
import { Component } from "./component.js";
|
|
3
4
|
import { seekRow, style } from "./shared.js";
|
|
4
|
-
import { live } from "../controls/session.js";
|
|
5
5
|
// src/elements/live-button.ts
|
|
6
6
|
/**
|
|
7
7
|
* <mbx-live-button>: a dot and the word, the dot red at the edge and grey
|
|
@@ -16,7 +16,7 @@ import { live } from "../controls/session.js";
|
|
|
16
16
|
* `text`, the name from `label-live` and `label-at-edge`. It sits in the
|
|
17
17
|
* bar's seek row unless the page says otherwise.
|
|
18
18
|
*/
|
|
19
|
-
const STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{height:2.5em;font:inherit;letter-spacing:.06em;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;align-items:center;padding:0 .5em;font-size:.75em;font-weight:700;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:disabled{cursor:default;opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=dot]{background:var(--mbx-muted);border-radius:50%;width:.625em;height:.625em;margin-right:.375em;transition:background .2s}:host([at-edge]) [part~=dot]{background:var(--mbx-live);box-shadow:0 0 6px var(--mbx-live)}@media (prefers-reduced-motion:reduce){[part~=dot]{transition:none}}";
|
|
19
|
+
const STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{height:2.5em;font:inherit;letter-spacing:.06em;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;align-items:center;padding:0 .5em;font-size:.75em;font-weight:700;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:disabled{cursor:default;opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline-style:var(--mbx-focus-ring,none)}[part~=dot]{background:var(--mbx-muted);border-radius:50%;width:.625em;height:.625em;margin-right:.375em;transition:background .2s}:host([at-edge]) [part~=dot]{background:var(--mbx-live);box-shadow:0 0 6px var(--mbx-live)}@media (prefers-reduced-motion:reduce){[part~=dot]{transition:none}}";
|
|
20
20
|
var MbxLiveButton = class extends Component {
|
|
21
21
|
static get observedAttributes() {
|
|
22
22
|
return [
|
|
@@ -46,7 +46,7 @@ var MbxLiveButton = class extends Component {
|
|
|
46
46
|
const tick = () => {
|
|
47
47
|
this.render();
|
|
48
48
|
};
|
|
49
|
-
this.listen(player.
|
|
49
|
+
this.listen(player.media, ["timeupdate", "emptied"], tick);
|
|
50
50
|
this.listen(player, ["sourcechange"], tick);
|
|
51
51
|
this.observe(player, ["live", "seekable"], tick);
|
|
52
52
|
this.render();
|
|
@@ -35,7 +35,7 @@ var MbxMarkerButton = class extends Component {
|
|
|
35
35
|
this.button.append(this.text, chevron);
|
|
36
36
|
this.button.addEventListener("click", () => {
|
|
37
37
|
var _this$player;
|
|
38
|
-
const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.
|
|
38
|
+
const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.media;
|
|
39
39
|
if (video !== void 0 && this.marker !== null) video.currentTime = this.marker.end;
|
|
40
40
|
});
|
|
41
41
|
root.append(style(BUTTON_STYLE + STYLE_CSS), this.button);
|
|
@@ -45,7 +45,7 @@ var MbxMarkerButton = class extends Component {
|
|
|
45
45
|
super.connectedCallback();
|
|
46
46
|
}
|
|
47
47
|
attach(player) {
|
|
48
|
-
this.listen(player.
|
|
48
|
+
this.listen(player.media, [
|
|
49
49
|
"timeupdate",
|
|
50
50
|
"seeking",
|
|
51
51
|
"emptied"
|
|
@@ -88,7 +88,7 @@ var MbxMarkerButton = class extends Component {
|
|
|
88
88
|
render() {
|
|
89
89
|
var _player$markers$withi, _this$marker, _this$getAttribute;
|
|
90
90
|
const player = this.player;
|
|
91
|
-
this.marker = (_player$markers$withi = player === null || player === void 0 ? void 0 : player.markers.within(player.
|
|
91
|
+
this.marker = (_player$markers$withi = player === null || player === void 0 ? void 0 : player.markers.within(player.media.currentTime).find((marker) => marker.kind !== "blocked")) !== null && _player$markers$withi !== void 0 ? _player$markers$withi : null;
|
|
92
92
|
if (((_this$marker = this.marker) === null || _this$marker === void 0 ? void 0 : _this$marker.kind) === "closing-credits" && (player === null || player === void 0 ? void 0 : player.hasAttribute("upnext")) === true) this.marker = null;
|
|
93
93
|
this.hidden = this.marker === null;
|
|
94
94
|
if (this.marker === null) return;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { fill } from "../labels.js";
|
|
2
1
|
import { icon } from "../controls/icons.js";
|
|
2
|
+
import { menu } from "../controls/menu.js";
|
|
3
|
+
import { fill } from "../labels.js";
|
|
3
4
|
import { Component } from "./component.js";
|
|
4
5
|
import { MENU_STYLE, iconSlots, style } from "./shared.js";
|
|
5
|
-
import { menu } from "../controls/menu.js";
|
|
6
6
|
// src/elements/menu-element.ts
|
|
7
7
|
var MenuElement = class extends Component {
|
|
8
8
|
constructor(states, glyphs) {
|
|
@@ -11,8 +11,8 @@ var MenuElement = class extends Component {
|
|
|
11
11
|
this.menu = menu({
|
|
12
12
|
host: this,
|
|
13
13
|
picture: () => {
|
|
14
|
-
var _this$player$
|
|
15
|
-
return (_this$player$
|
|
14
|
+
var _this$player$media$ge, _this$player;
|
|
15
|
+
return (_this$player$media$ge = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.media.getBoundingClientRect()) !== null && _this$player$media$ge !== void 0 ? _this$player$media$ge : null;
|
|
16
16
|
},
|
|
17
17
|
frame: () => this.player,
|
|
18
18
|
back: (page) => fill(this.word("label-back", "menuBack", "Back from {page}"), { page })
|
|
@@ -33,7 +33,7 @@ var MbxMuteButton = class extends Component {
|
|
|
33
33
|
}
|
|
34
34
|
toggle() {
|
|
35
35
|
var _this$player;
|
|
36
|
-
const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.
|
|
36
|
+
const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.media;
|
|
37
37
|
if (video === void 0) return;
|
|
38
38
|
if (video.muted) {
|
|
39
39
|
video.muted = false;
|
|
@@ -41,14 +41,14 @@ var MbxMuteButton = class extends Component {
|
|
|
41
41
|
} else video.muted = true;
|
|
42
42
|
}
|
|
43
43
|
attach(player) {
|
|
44
|
-
this.listen(player.
|
|
44
|
+
this.listen(player.media, ["volumechange", "emptied"], () => {
|
|
45
45
|
this.render();
|
|
46
46
|
});
|
|
47
47
|
this.render();
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
50
|
var _this$player2;
|
|
51
|
-
const video = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.
|
|
51
|
+
const video = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.media;
|
|
52
52
|
if (video === void 0) return;
|
|
53
53
|
const silent = video.muted || video.volume === 0;
|
|
54
54
|
show(this.slots, silent ? "mute" : video.volume <= .5 ? "low" : "high");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { icon } from "../controls/icons.js";
|
|
2
|
+
import { pictureInPicture } from "../controls/pip.js";
|
|
3
|
+
import { videoOf } from "../host.js";
|
|
2
4
|
import { Component } from "./component.js";
|
|
3
5
|
import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
|
|
4
|
-
import { pictureInPicture } from "../controls/pip.js";
|
|
5
6
|
// src/elements/pip-button.ts
|
|
6
7
|
/**
|
|
7
8
|
* <mbx-pip-button>: picture in picture, through whichever API the browser
|
|
@@ -17,6 +18,7 @@ var MbxPipButton = class extends Component {
|
|
|
17
18
|
}
|
|
18
19
|
constructor() {
|
|
19
20
|
super();
|
|
21
|
+
this.leaves = "device";
|
|
20
22
|
this.api = null;
|
|
21
23
|
const root = this.attachShadow({ mode: "open" });
|
|
22
24
|
this.button = document.createElement("button");
|
|
@@ -31,7 +33,9 @@ var MbxPipButton = class extends Component {
|
|
|
31
33
|
root.append(style(BUTTON_STYLE), this.button);
|
|
32
34
|
}
|
|
33
35
|
attach(player) {
|
|
34
|
-
const
|
|
36
|
+
const video = videoOf(player);
|
|
37
|
+
if (video === null) return;
|
|
38
|
+
const api = pictureInPicture(video);
|
|
35
39
|
this.api = api;
|
|
36
40
|
this.keep(api.watch(() => {
|
|
37
41
|
this.render();
|
|
@@ -41,13 +41,13 @@ var MbxPlayButton = class extends Component {
|
|
|
41
41
|
}
|
|
42
42
|
toggle() {
|
|
43
43
|
var _this$player;
|
|
44
|
-
const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.
|
|
44
|
+
const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.media;
|
|
45
45
|
if (video === void 0) return;
|
|
46
46
|
if (video.paused) video.play().catch(() => void 0);
|
|
47
47
|
else video.pause();
|
|
48
48
|
}
|
|
49
49
|
attach(player) {
|
|
50
|
-
this.listen(player.
|
|
50
|
+
this.listen(player.media, [
|
|
51
51
|
"play",
|
|
52
52
|
"pause",
|
|
53
53
|
"ended",
|
|
@@ -63,7 +63,7 @@ var MbxPlayButton = class extends Component {
|
|
|
63
63
|
render() {
|
|
64
64
|
const player = this.player;
|
|
65
65
|
if (player === null) return;
|
|
66
|
-
const state = player.
|
|
66
|
+
const state = player.media.ended ? "replay" : shownPaused(player) ? "play" : "pause";
|
|
67
67
|
show(this.slots, state);
|
|
68
68
|
this.button.setAttribute("aria-label", this.word(`label-${state}`, state, LABELS[state]));
|
|
69
69
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { show } from "./shared.js";
|
|
2
|
-
import { MenuElement, single } from "./menu-element.js";
|
|
3
1
|
import { qualityLabels, qualityNames } from "../controls/quality-names.js";
|
|
2
|
+
import { MenuElement, single } from "./menu-element.js";
|
|
3
|
+
import { show } from "./shared.js";
|
|
4
4
|
// src/elements/quality-menu.ts
|
|
5
5
|
const AUTO = "auto";
|
|
6
6
|
var MbxQualityMenu = class extends MenuElement {
|
|
@@ -13,6 +13,7 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
13
13
|
}
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...single("quality"));
|
|
16
|
+
this.leaves = "device";
|
|
16
17
|
this.engine = null;
|
|
17
18
|
this.playing = void 0;
|
|
18
19
|
show(this.slots, "default");
|
|
@@ -31,9 +32,9 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
31
32
|
const clock = () => {
|
|
32
33
|
if (this.playingName() !== this.playing) this.render();
|
|
33
34
|
};
|
|
34
|
-
player.
|
|
35
|
+
player.media.addEventListener("timeupdate", clock);
|
|
35
36
|
const offs = [
|
|
36
|
-
() => player.
|
|
37
|
+
() => player.media.removeEventListener("timeupdate", clock),
|
|
37
38
|
engine.on("tracks:changed", tick),
|
|
38
39
|
engine.on("tracks:selected", tick),
|
|
39
40
|
engine.on("quality:constraints-unsatisfiable", tick),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { format } from "../controls/time.js";
|
|
2
1
|
import { live, span } from "../controls/session.js";
|
|
2
|
+
import { format } from "../controls/time.js";
|
|
3
3
|
import { TimeElement } from "./time-element.js";
|
|
4
4
|
// src/elements/remaining-time.ts
|
|
5
5
|
/**
|
|
@@ -16,7 +16,7 @@ var MbxRemainingTime = class extends TimeElement {
|
|
|
16
16
|
render() {
|
|
17
17
|
const player = this.player;
|
|
18
18
|
if (player === null) return;
|
|
19
|
-
const video = player.
|
|
19
|
+
const video = player.media;
|
|
20
20
|
const engine = player.engine;
|
|
21
21
|
const on = live(engine) !== void 0;
|
|
22
22
|
this.hidden = on;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { el, setChildren } from "../dom.js";
|
|
2
1
|
import { icon } from "../controls/icons.js";
|
|
2
|
+
import { optional } from "../controls/session.js";
|
|
3
|
+
import { el, setChildren } from "../dom.js";
|
|
3
4
|
import { Component } from "./component.js";
|
|
4
5
|
import { BUTTON_STYLE, style } from "./shared.js";
|
|
5
|
-
import { optional } from "../controls/session.js";
|
|
6
6
|
// src/elements/scan-button.ts
|
|
7
7
|
/**
|
|
8
8
|
* <mbx-scan-button>: fast forward, or rewind with `direction="backward"`,
|
|
@@ -44,6 +44,7 @@ var MbxScanButton = class extends Component {
|
|
|
44
44
|
}
|
|
45
45
|
constructor() {
|
|
46
46
|
super();
|
|
47
|
+
this.leaves = "device";
|
|
47
48
|
const root = this.attachShadow({ mode: "open" });
|
|
48
49
|
this.button = el("button", "button");
|
|
49
50
|
this.button.type = "button";
|
|
@@ -85,7 +86,7 @@ var MbxScanButton = class extends Component {
|
|
|
85
86
|
const tick = () => {
|
|
86
87
|
this.render();
|
|
87
88
|
};
|
|
88
|
-
this.listen(player.
|
|
89
|
+
this.listen(player.media, ["emptied"], tick);
|
|
89
90
|
this.observe(player, ["live", "seekable"], tick);
|
|
90
91
|
this.follow(player, (engine) => {
|
|
91
92
|
tick();
|