videojs-vue 0.2.0 → 0.3.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/README.md +6 -0
- package/dist/{Audio-DmoQgIRM.d.ts → audio/Audio.d.ts} +4 -5
- package/dist/audio/Audio.js +21 -0
- package/dist/audio/AudioPlayer.d.ts +948 -0
- package/dist/audio/AudioPlayer.js +10 -0
- package/dist/{AudioPlayerRoot-D47326rh.d.ts → audio/AudioPlayerRoot.d.ts} +34 -4
- package/dist/audio/AudioPlayerRoot.js +43 -0
- package/dist/audio/composables.d.ts +1 -1
- package/dist/audio/composables.js +11 -5
- package/dist/audio/core.d.ts +6 -5
- package/dist/audio/core.js +3 -1
- package/dist/audio/createAudioPlayer.d.ts +954 -0
- package/dist/{createAudioPlayer-BqZWB8il.js → audio/createAudioPlayer.js} +16 -8
- package/dist/audio/default.d.ts +5 -4
- package/dist/audio/default.js +1 -1
- package/dist/audio/index.d.ts +13 -952
- package/dist/audio/index.js +4 -9
- package/dist/audio/neutral.d.ts +5 -4
- package/dist/audio/neutral.js +1 -1
- package/dist/audio/skins/createAudioSkin.d.ts +5 -0
- package/dist/audio/skins/createAudioSkin.js +20 -0
- package/dist/audio/skins/default.d.ts +6 -2
- package/dist/audio/skins/default.js +1 -1
- package/dist/audio/skins/neutral.d.ts +6 -2
- package/dist/audio/skins/neutral.js +1 -1
- package/dist/audio/skins.d.ts +3 -0
- package/dist/audio/skins.js +3 -0
- package/dist/audio/types.d.ts +22 -0
- package/dist/audio/types.js +0 -0
- package/dist/composables/index.d.ts +3 -2
- package/dist/composables/index.js +3 -1
- package/dist/composables/usePlayerActions.d.ts +9 -0
- package/dist/composables/usePlayerActions.js +17 -0
- package/dist/composables/usePlayerState.d.ts +12 -0
- package/dist/composables/usePlayerState.js +19 -0
- package/dist/composables/useStoreSelection.d.ts +9 -0
- package/dist/{useStoreSelection-BFUpSMPo.js → composables/useStoreSelection.js} +1 -1
- package/dist/core/index.d.ts +6 -2
- package/dist/core/index.js +3 -1
- package/dist/i18n/MediaI18n.d.ts +16 -0
- package/dist/i18n/MediaI18n.js +26 -0
- package/dist/i18n/MediaText.d.ts +14 -0
- package/dist/i18n/MediaText.js +37 -0
- package/dist/i18n/index.d.ts +3 -29
- package/dist/i18n/index.js +2 -52
- package/dist/index.d.ts +16 -5
- package/dist/index.js +5 -9
- package/dist/media/Video.d.ts +79 -0
- package/dist/media/Video.js +21 -0
- package/dist/media/events.d.ts +5 -0
- package/dist/media/events.js +30 -0
- package/dist/media/hls.d.ts +1 -2
- package/dist/media/hls.js +3 -1
- package/dist/media/props.d.ts +45 -0
- package/dist/media/props.js +28 -0
- package/dist/media/types.d.ts +23 -0
- package/dist/media/types.js +0 -0
- package/dist/media/useMediaElement.d.ts +18 -0
- package/dist/media/useMediaElement.js +91 -0
- package/dist/node_modules/.pnpm/@vue_reactivity@3.5.43/node_modules/@vue/reactivity/dist/reactivity.d.ts +3 -0
- package/dist/player/PlayerRoot.d.ts +109 -0
- package/dist/player/PlayerRoot.js +43 -0
- package/dist/player/actions.d.ts +17 -0
- package/dist/{actions-CRZ5C4-3.js → player/actions.js} +1 -1
- package/dist/player/context.d.ts +18 -0
- package/dist/{context-Zjy9Z5Uy.js → player/context.js} +1 -1
- package/dist/player/events.d.ts +32 -0
- package/dist/player/events.js +13 -0
- package/dist/player/preservePlayerTree.d.ts +8 -0
- package/dist/player/preservePlayerTree.js +64 -0
- package/dist/player/types.d.ts +22 -0
- package/dist/player/types.js +0 -0
- package/dist/player/usePlayerRoot.d.ts +32 -0
- package/dist/player/usePlayerRoot.js +89 -0
- package/dist/polyfills.d.ts +2 -0
- package/dist/polyfills.js +2 -0
- package/dist/register/audio/player.d.ts +1 -1
- package/dist/register/i18n.d.ts +1 -1
- package/dist/register/video/compat-skin.d.ts +1 -0
- package/dist/register/video/compat-skin.js +1 -0
- package/dist/register/video/neutral-skin.d.ts +1 -1
- package/dist/register/video/player.d.ts +1 -1
- package/dist/register/video/skin.d.ts +1 -1
- package/dist/skins/compat.d.ts +6 -0
- package/dist/skins/compat.js +6 -0
- package/dist/skins/createVideoSkin.d.ts +5 -0
- package/dist/skins/createVideoSkin.js +25 -0
- package/dist/skins/default.d.ts +6 -2
- package/dist/skins/default.js +1 -1
- package/dist/skins/index.d.ts +3 -0
- package/dist/skins/index.js +3 -0
- package/dist/skins/legacy/LegacyControls.d.ts +8 -0
- package/dist/skins/legacy/LegacyControls.js +89 -0
- package/dist/skins/legacy/useLegacySize.d.ts +9 -0
- package/dist/skins/legacy/useLegacySize.js +32 -0
- package/dist/skins/legacy.css +160 -0
- package/dist/skins/legacy.d.ts +6 -0
- package/dist/skins/legacy.js +36 -0
- package/dist/skins/neutral.d.ts +6 -2
- package/dist/skins/neutral.js +1 -1
- package/dist/skins/withSlot.d.ts +10 -0
- package/dist/{withSlot-DQS-dOOR.js → skins/withSlot.js} +1 -1
- package/dist/ui/captions-button.d.ts +1 -1
- package/dist/ui/captions-button.js +3 -3
- package/dist/ui/container.d.ts +1 -1
- package/dist/ui/container.js +2 -2
- package/dist/ui/controls-content.d.ts +1 -1
- package/dist/ui/controls-content.js +2 -2
- package/dist/ui/controls-group.d.ts +1 -1
- package/dist/ui/controls-group.js +2 -2
- package/dist/ui/controls.d.ts +1 -1
- package/dist/ui/controls.js +2 -2
- package/dist/ui/createElementComponent.d.ts +10 -0
- package/dist/{createElementComponent-CUeAF_JU.js → ui/createElementComponent.js} +6 -3
- package/dist/ui/fullscreen-button.d.ts +1 -1
- package/dist/ui/fullscreen-button.js +3 -3
- package/dist/ui/hotkey.d.ts +1 -1
- package/dist/ui/hotkey.js +3 -3
- package/dist/ui/index.d.ts +10 -10
- package/dist/ui/index.js +21 -21
- package/dist/ui/mute-button.d.ts +1 -1
- package/dist/ui/mute-button.js +3 -3
- package/dist/ui/pip-button.d.ts +1 -1
- package/dist/ui/pip-button.js +3 -3
- package/dist/ui/play-button.d.ts +1 -1
- package/dist/ui/play-button.js +3 -3
- package/dist/ui/poster.d.ts +1 -1
- package/dist/ui/poster.js +2 -2
- package/dist/ui/props.d.ts +25 -0
- package/dist/{props-D3O1wYXT.js → ui/props.js} +1 -1
- package/dist/ui/seek-button.d.ts +1 -1
- package/dist/ui/seek-button.js +3 -3
- package/dist/ui/slider-buffer.d.ts +1 -1
- package/dist/ui/slider-buffer.js +2 -2
- package/dist/ui/slider-fill.d.ts +1 -1
- package/dist/ui/slider-fill.js +2 -2
- package/dist/ui/slider-thumb.d.ts +1 -1
- package/dist/ui/slider-thumb.js +2 -2
- package/dist/ui/slider-track.d.ts +1 -1
- package/dist/ui/slider-track.js +2 -2
- package/dist/ui/status-announcer.d.ts +1 -1
- package/dist/ui/status-announcer.js +2 -2
- package/dist/ui/time-slider.d.ts +1 -1
- package/dist/ui/time-slider.js +3 -3
- package/dist/ui/time.d.ts +1 -1
- package/dist/ui/time.js +3 -3
- package/dist/ui/volume-slider.d.ts +1 -1
- package/dist/ui/volume-slider.js +3 -3
- package/dist/{index-DhJ5A5TI.d.ts → video/VideoPlayer.d.ts} +21 -233
- package/dist/video/VideoPlayer.js +10 -0
- package/dist/video/compat.d.ts +1068 -0
- package/dist/video/compat.js +6 -0
- package/dist/video/createVideoPlayer.d.ts +1076 -0
- package/dist/{createVideoPlayer-CU9HWSAy.js → video/createVideoPlayer.js} +17 -9
- package/dist/video/default.d.ts +18 -15
- package/dist/video/default.js +1 -1
- package/dist/video/legacy.d.ts +1068 -0
- package/dist/video/legacy.js +6 -0
- package/dist/video/neutral.d.ts +18 -15
- package/dist/video/neutral.js +1 -1
- package/package.json +38 -7
- package/dist/Audio-D-RH-zmq.js +0 -55
- package/dist/Video-fUL_ClzK.js +0 -55
- package/dist/createAudioPlayer-BhUZLd4H.d.ts +0 -11
- package/dist/createAudioSkin-BNmtEp7u.js +0 -17
- package/dist/createVideoSkin-BxpJYgKe.js +0 -22
- package/dist/default-3MW_94HC.d.ts +0 -7
- package/dist/default-C4INOLJr.d.ts +0 -7
- package/dist/i18n-C4MwExsj.d.ts +0 -1
- package/dist/neutral-DWxkiOeo.d.ts +0 -7
- package/dist/neutral-skin-B8htnvI5.d.ts +0 -1
- package/dist/neutral-x5edtrGj.d.ts +0 -7
- package/dist/player-DwjY3MEu.d.ts +0 -1
- package/dist/player-RUaCdKKE.d.ts +0 -1
- package/dist/skin-0b-NvVj8.d.ts +0 -1
- package/dist/types-DR9kogyX.d.ts +0 -24
- package/dist/types-wAkjM01D.d.ts +0 -42
- package/dist/useMediaElement-CO_r--i0.js +0 -143
- package/dist/usePlayerActions-D3ILoEVZ.js +0 -28
- package/dist/usePlayerActions-McyRKswV.d.ts +0 -21
- package/dist/usePlayerRoot-Nsnn7msd.js +0 -162
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { MEDIA_CONTEXT } from "./context.js";
|
|
2
|
+
import { nextTick, onActivated, onBeforeUnmount, onDeactivated, onMounted, provide, shallowRef } from "vue";
|
|
3
|
+
//#region src/player/usePlayerRoot.ts
|
|
4
|
+
/**
|
|
5
|
+
* Share lifecycle and media synchronization without registering either preset.
|
|
6
|
+
* @param {(getStore: () => Store | null) => Actions} createActions - Binds the preset's commands to the active store.
|
|
7
|
+
* @param {RootCallbacks} callbacks - Forward lifecycle, media, and confirmed setting events.
|
|
8
|
+
* @returns {object} The root element ref and live player handle.
|
|
9
|
+
*/
|
|
10
|
+
function usePlayerRoot(createActions, callbacks) {
|
|
11
|
+
const element = shallowRef(null);
|
|
12
|
+
const store = shallowRef(null);
|
|
13
|
+
const media = shallowRef(null);
|
|
14
|
+
let isActive = true;
|
|
15
|
+
let activation = 0;
|
|
16
|
+
const handle = {
|
|
17
|
+
get element() {
|
|
18
|
+
return store.value ? element.value : null;
|
|
19
|
+
},
|
|
20
|
+
get store() {
|
|
21
|
+
return store.value;
|
|
22
|
+
},
|
|
23
|
+
get media() {
|
|
24
|
+
return store.value ? media.value : null;
|
|
25
|
+
},
|
|
26
|
+
...createActions(() => store.value)
|
|
27
|
+
};
|
|
28
|
+
let isSettingsSyncPending = false;
|
|
29
|
+
let confirmedSettings;
|
|
30
|
+
function confirmSettings() {
|
|
31
|
+
if (isSettingsSyncPending) return;
|
|
32
|
+
isSettingsSyncPending = true;
|
|
33
|
+
nextTick(() => {
|
|
34
|
+
isSettingsSyncPending = false;
|
|
35
|
+
const current = media.value;
|
|
36
|
+
if (!isActive || !current) return;
|
|
37
|
+
const actual = {
|
|
38
|
+
volume: current.volume,
|
|
39
|
+
muted: current.muted,
|
|
40
|
+
playbackRate: current.playbackRate
|
|
41
|
+
};
|
|
42
|
+
if (actual.volume !== (confirmedSettings === null || confirmedSettings === void 0 ? void 0 : confirmedSettings.volume)) callbacks.onVolume(actual.volume);
|
|
43
|
+
if (actual.muted !== (confirmedSettings === null || confirmedSettings === void 0 ? void 0 : confirmedSettings.muted)) callbacks.onMuted(actual.muted);
|
|
44
|
+
if (actual.playbackRate !== (confirmedSettings === null || confirmedSettings === void 0 ? void 0 : confirmedSettings.playbackRate)) callbacks.onPlaybackRate(actual.playbackRate);
|
|
45
|
+
confirmedSettings = actual;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
provide(MEDIA_CONTEXT, {
|
|
49
|
+
handle,
|
|
50
|
+
setMedia(next) {
|
|
51
|
+
media.value = next;
|
|
52
|
+
confirmedSettings = void 0;
|
|
53
|
+
},
|
|
54
|
+
onMediaEvent(name, event) {
|
|
55
|
+
callbacks.onMediaEvent(name, event);
|
|
56
|
+
if (name === "volumechange" || name === "ratechange") confirmSettings();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
async function activate() {
|
|
60
|
+
isActive = true;
|
|
61
|
+
const token = ++activation;
|
|
62
|
+
await nextTick();
|
|
63
|
+
const current = element.value;
|
|
64
|
+
if (!current) return;
|
|
65
|
+
await current.updateComplete;
|
|
66
|
+
if (!isActive || token !== activation || element.value !== current) return;
|
|
67
|
+
const next = current.store;
|
|
68
|
+
if (store.value === next) return;
|
|
69
|
+
store.value = next;
|
|
70
|
+
callbacks.onReady();
|
|
71
|
+
}
|
|
72
|
+
function deactivate() {
|
|
73
|
+
var _media$value;
|
|
74
|
+
isActive = false;
|
|
75
|
+
activation++;
|
|
76
|
+
(_media$value = media.value) === null || _media$value === void 0 || _media$value.pause();
|
|
77
|
+
store.value = null;
|
|
78
|
+
}
|
|
79
|
+
onMounted(activate);
|
|
80
|
+
onActivated(activate);
|
|
81
|
+
onDeactivated(deactivate);
|
|
82
|
+
onBeforeUnmount(deactivate);
|
|
83
|
+
return {
|
|
84
|
+
element,
|
|
85
|
+
handle
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { usePlayerRoot };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "@videojs/html/audio/player";
|
package/dist/register/i18n.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "@videojs/html/i18n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@videojs/html/video/compat-skin";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@videojs/html/video/compat-skin";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "@videojs/html/video/neutral-skin";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "@videojs/html/video/player";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "@videojs/html/video/skin";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "../register/video/compat-skin.js";
|
|
2
|
+
//#region src/skins/compat.d.ts
|
|
3
|
+
export declare const CompatVideoSkin: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
//#endregion
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createVideoSkin } from "./createVideoSkin.js";
|
|
2
|
+
import "../register/video/compat-skin.js";
|
|
3
|
+
//#region src/skins/compat.ts
|
|
4
|
+
const CompatVideoSkin = /* @__PURE__ */ createVideoSkin("CompatVideoSkin", "video-compat-skin");
|
|
5
|
+
//#endregion
|
|
6
|
+
export { CompatVideoSkin };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region src/skins/createVideoSkin.d.ts
|
|
2
|
+
export declare function createVideoSkin(name: string, tag: string): import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
5
|
+
//#endregion
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { withSlot } from "./withSlot.js";
|
|
2
|
+
import { defineComponent, h, mergeProps } from "vue";
|
|
3
|
+
//#region src/skins/createVideoSkin.ts
|
|
4
|
+
function createVideoSkin(name, tag) {
|
|
5
|
+
return defineComponent({
|
|
6
|
+
name,
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
setup(_props, { attrs, slots }) {
|
|
9
|
+
return () => {
|
|
10
|
+
var _slots$default, _slots$poster, _slots$thumbnail;
|
|
11
|
+
return h(tag, mergeProps({ style: {
|
|
12
|
+
display: "block",
|
|
13
|
+
width: "100%",
|
|
14
|
+
aspectRatio: "16 / 9"
|
|
15
|
+
} }, attrs), [
|
|
16
|
+
(_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots),
|
|
17
|
+
withSlot((_slots$poster = slots["poster"]) === null || _slots$poster === void 0 ? void 0 : _slots$poster.call(slots), "poster"),
|
|
18
|
+
withSlot((_slots$thumbnail = slots["thumbnail"]) === null || _slots$thumbnail === void 0 ? void 0 : _slots$thumbnail.call(slots), "thumbnail")
|
|
19
|
+
]);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { createVideoSkin };
|
package/dist/skins/default.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "../register/video/skin.js";
|
|
2
|
+
//#region src/skins/default.d.ts
|
|
3
|
+
export declare const DefaultVideoSkin: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
//#endregion
|
package/dist/skins/default.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../register/video/skin.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createVideoSkin } from "./createVideoSkin.js";
|
|
3
3
|
//#region src/skins/default.ts
|
|
4
4
|
const DefaultVideoSkin = /* @__PURE__ */ createVideoSkin("DefaultVideoSkin", "video-skin");
|
|
5
5
|
//#endregion
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/skins/legacy/LegacyControls.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Reuse upstream accessible controls; native select avoids popover dependencies.
|
|
4
|
+
*/
|
|
5
|
+
export declare const LegacyControls: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
//#endregion
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { usePlayerState } from "../../composables/usePlayerState.js";
|
|
2
|
+
import { usePlayerActions } from "../../composables/usePlayerActions.js";
|
|
3
|
+
import { CaptionsButton } from "../../ui/captions-button.js";
|
|
4
|
+
import { MediaControls } from "../../ui/controls.js";
|
|
5
|
+
import { MediaControlsContent } from "../../ui/controls-content.js";
|
|
6
|
+
import { FullscreenButton } from "../../ui/fullscreen-button.js";
|
|
7
|
+
import { Hotkey } from "../../ui/hotkey.js";
|
|
8
|
+
import { MuteButton } from "../../ui/mute-button.js";
|
|
9
|
+
import { PiPButton } from "../../ui/pip-button.js";
|
|
10
|
+
import { PlayButton } from "../../ui/play-button.js";
|
|
11
|
+
import { SliderBuffer } from "../../ui/slider-buffer.js";
|
|
12
|
+
import { SliderFill } from "../../ui/slider-fill.js";
|
|
13
|
+
import { SliderThumb } from "../../ui/slider-thumb.js";
|
|
14
|
+
import { SliderTrack } from "../../ui/slider-track.js";
|
|
15
|
+
import { StatusAnnouncer } from "../../ui/status-announcer.js";
|
|
16
|
+
import { Time } from "../../ui/time.js";
|
|
17
|
+
import { TimeSlider } from "../../ui/time-slider.js";
|
|
18
|
+
import { VolumeSlider } from "../../ui/volume-slider.js";
|
|
19
|
+
import { computed, defineComponent, h } from "vue";
|
|
20
|
+
//#region src/skins/legacy/LegacyControls.ts
|
|
21
|
+
function sliderParts(buffer = false) {
|
|
22
|
+
return [
|
|
23
|
+
h(SliderTrack),
|
|
24
|
+
buffer ? h(SliderBuffer) : null,
|
|
25
|
+
h(SliderFill),
|
|
26
|
+
h(SliderThumb)
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Reuse upstream accessible controls; native select avoids popover dependencies.
|
|
31
|
+
*/
|
|
32
|
+
const LegacyControls = defineComponent({
|
|
33
|
+
name: "LegacyControls",
|
|
34
|
+
setup() {
|
|
35
|
+
const paused = usePlayerState((state) => state.paused);
|
|
36
|
+
const muted = usePlayerState((state) => state.muted);
|
|
37
|
+
const rate = usePlayerState((state) => state.playbackRate);
|
|
38
|
+
const rates = usePlayerState((state) => state.playbackRates);
|
|
39
|
+
const options = computed(() => {
|
|
40
|
+
return [.../* @__PURE__ */ new Set([...rates.value ?? [1], rate.value ?? 1])].sort((a, b) => a - b);
|
|
41
|
+
});
|
|
42
|
+
const actions = usePlayerActions();
|
|
43
|
+
function changeRate(event) {
|
|
44
|
+
if (event.target instanceof HTMLSelectElement) actions.setPlaybackRate(Number(event.target.value));
|
|
45
|
+
}
|
|
46
|
+
return () => [
|
|
47
|
+
h(Hotkey, {
|
|
48
|
+
keys: "Space",
|
|
49
|
+
action: "togglePaused"
|
|
50
|
+
}),
|
|
51
|
+
h(Hotkey, {
|
|
52
|
+
keys: "k",
|
|
53
|
+
action: "togglePaused"
|
|
54
|
+
}),
|
|
55
|
+
h(Hotkey, {
|
|
56
|
+
keys: "ArrowRight",
|
|
57
|
+
action: "seekStep",
|
|
58
|
+
value: 10
|
|
59
|
+
}),
|
|
60
|
+
h(Hotkey, {
|
|
61
|
+
keys: "ArrowLeft",
|
|
62
|
+
action: "seekStep",
|
|
63
|
+
value: -10
|
|
64
|
+
}),
|
|
65
|
+
h(StatusAnnouncer, { class: "vjs-legacy__sr-only" }),
|
|
66
|
+
h(MediaControls, { visibility: "always" }, { default: () => h(MediaControlsContent, { class: "vjs-legacy__controls" }, { default: () => [h(TimeSlider, { class: "vjs-legacy__slider" }, { default: () => sliderParts(true) }), h("div", { class: "vjs-legacy__row" }, [
|
|
67
|
+
h(PlayButton, { class: "vjs-legacy__button" }, { default: () => paused.value === false ? "❚❚" : "▶" }),
|
|
68
|
+
h(Time, { type: "current" }),
|
|
69
|
+
h("span", { "aria-hidden": "true" }, "/"),
|
|
70
|
+
h(Time, { type: "duration" }),
|
|
71
|
+
h("span", { class: "vjs-legacy__spacer" }),
|
|
72
|
+
h(MuteButton, { class: "vjs-legacy__button" }, { default: () => muted.value ? "🔇" : "🔊" }),
|
|
73
|
+
h(VolumeSlider, { class: "vjs-legacy__slider vjs-legacy__volume" }, { default: () => sliderParts() }),
|
|
74
|
+
h("select", {
|
|
75
|
+
class: "vjs-legacy__rate",
|
|
76
|
+
"aria-label": "Playback speed",
|
|
77
|
+
disabled: rate.value === void 0,
|
|
78
|
+
value: rate.value ?? 1,
|
|
79
|
+
onChange: changeRate
|
|
80
|
+
}, options.value.map((value) => h("option", { value }, `${value}×`))),
|
|
81
|
+
h(CaptionsButton, { class: "vjs-legacy__button" }, { default: () => "CC" }),
|
|
82
|
+
h(PiPButton, { class: "vjs-legacy__button vjs-legacy__pip" }, { default: () => "▣" }),
|
|
83
|
+
h(FullscreenButton, { class: "vjs-legacy__button" }, { default: () => "⛶" })
|
|
84
|
+
])] }) })
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
//#endregion
|
|
89
|
+
export { LegacyControls };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ShallowRef } from "vue";
|
|
2
|
+
//#region src/skins/legacy/useLegacySize.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Observe the player, including when it is embedded in a narrow container.
|
|
5
|
+
* @param {ShallowRef<HTMLElement | null>} element - The visible player surface.
|
|
6
|
+
* @returns {ShallowRef<'small' | 'large'>} The current layout size.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useLegacySize(element: ShallowRef<HTMLElement | null>): ShallowRef<"large" | "small", "large" | "small">;
|
|
9
|
+
//#endregion
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { onActivated, onBeforeUnmount, onDeactivated, onMounted, shallowRef } from "vue";
|
|
2
|
+
//#region src/skins/legacy/useLegacySize.ts
|
|
3
|
+
const SMALL_PLAYER_WIDTH = 480;
|
|
4
|
+
/**
|
|
5
|
+
* Observe the player, including when it is embedded in a narrow container.
|
|
6
|
+
* @param {ShallowRef<HTMLElement | null>} element - The visible player surface.
|
|
7
|
+
* @returns {ShallowRef<'small' | 'large'>} The current layout size.
|
|
8
|
+
*/
|
|
9
|
+
function useLegacySize(element) {
|
|
10
|
+
const size = shallowRef("small");
|
|
11
|
+
let observer;
|
|
12
|
+
function stop() {
|
|
13
|
+
observer === null || observer === void 0 || observer.disconnect();
|
|
14
|
+
observer = void 0;
|
|
15
|
+
}
|
|
16
|
+
function start() {
|
|
17
|
+
stop();
|
|
18
|
+
if (!element.value || typeof ResizeObserver === "undefined") return;
|
|
19
|
+
observer = new ResizeObserver((entries) => {
|
|
20
|
+
const [entry] = entries;
|
|
21
|
+
if (entry) size.value = entry.contentRect.width < SMALL_PLAYER_WIDTH ? "small" : "large";
|
|
22
|
+
});
|
|
23
|
+
observer.observe(element.value);
|
|
24
|
+
}
|
|
25
|
+
onMounted(start);
|
|
26
|
+
onActivated(start);
|
|
27
|
+
onDeactivated(stop);
|
|
28
|
+
onBeforeUnmount(stop);
|
|
29
|
+
return size;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { useLegacySize };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
.vjs-legacy {
|
|
2
|
+
--vjs-legacy-background: #000;
|
|
3
|
+
--vjs-legacy-foreground: #fff;
|
|
4
|
+
--vjs-legacy-controls: rgba(0, 0, 0, 0.8);
|
|
5
|
+
--vjs-legacy-accent: #409eff;
|
|
6
|
+
position: relative;
|
|
7
|
+
background: var(--vjs-legacy-background);
|
|
8
|
+
color: var(--vjs-legacy-foreground);
|
|
9
|
+
font: 14px/1.4 sans-serif;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.vjs-legacy__surface {
|
|
13
|
+
position: relative;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.vjs-legacy__surface > video,
|
|
19
|
+
.vjs-legacy__surface > hlsjs-video,
|
|
20
|
+
.vjs-legacy__poster {
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
display: block;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
object-fit: contain;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.vjs-legacy__poster {
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.vjs-legacy__controls {
|
|
35
|
+
position: absolute;
|
|
36
|
+
right: 0;
|
|
37
|
+
bottom: 0;
|
|
38
|
+
left: 0;
|
|
39
|
+
display: block;
|
|
40
|
+
padding: 4px 12px;
|
|
41
|
+
background: var(--vjs-legacy-controls);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.vjs-legacy__row {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
flex-wrap: wrap;
|
|
48
|
+
gap: 4px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.vjs-legacy__spacer {
|
|
52
|
+
flex: 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.vjs-legacy__button,
|
|
56
|
+
.vjs-legacy__rate {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
min-width: 32px;
|
|
62
|
+
min-height: 32px;
|
|
63
|
+
padding: 4px;
|
|
64
|
+
border: 1px solid transparent;
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
background: transparent;
|
|
67
|
+
color: inherit;
|
|
68
|
+
font: inherit;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.vjs-legacy__rate option {
|
|
73
|
+
background: #000;
|
|
74
|
+
color: #fff;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.vjs-legacy__button:hover {
|
|
78
|
+
background: rgba(255, 255, 255, 0.2);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.vjs-legacy :focus-visible {
|
|
82
|
+
outline: 2px solid var(--vjs-legacy-accent);
|
|
83
|
+
outline-offset: 2px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.vjs-legacy [hidden] {
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.vjs-legacy [aria-disabled="true"] {
|
|
91
|
+
opacity: 0.5;
|
|
92
|
+
cursor: default;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.vjs-legacy__slider {
|
|
96
|
+
position: relative;
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
height: 24px;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
touch-action: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.vjs-legacy__slider media-slider-track,
|
|
105
|
+
.vjs-legacy__slider media-slider-buffer,
|
|
106
|
+
.vjs-legacy__slider media-slider-fill {
|
|
107
|
+
position: absolute;
|
|
108
|
+
left: 0;
|
|
109
|
+
height: 4px;
|
|
110
|
+
border-radius: 2px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.vjs-legacy__slider media-slider-track {
|
|
114
|
+
width: 100%;
|
|
115
|
+
background: rgba(255, 255, 255, 0.25);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.vjs-legacy__slider media-slider-buffer {
|
|
119
|
+
width: var(--media-slider-buffer, 0%);
|
|
120
|
+
background: rgba(255, 255, 255, 0.5);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.vjs-legacy__slider media-slider-fill {
|
|
124
|
+
width: var(--media-slider-fill, 0%);
|
|
125
|
+
background: var(--vjs-legacy-accent);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.vjs-legacy__slider media-slider-thumb {
|
|
129
|
+
position: absolute;
|
|
130
|
+
left: var(--media-slider-fill, 0%);
|
|
131
|
+
width: 12px;
|
|
132
|
+
height: 12px;
|
|
133
|
+
border-radius: 50%;
|
|
134
|
+
background: var(--vjs-legacy-foreground);
|
|
135
|
+
transform: translateX(-50%);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.vjs-legacy__volume {
|
|
139
|
+
width: 64px;
|
|
140
|
+
margin: 0 8px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.vjs-legacy[data-size="small"] .vjs-legacy__volume,
|
|
144
|
+
.vjs-legacy[data-size="small"] .vjs-legacy__pip {
|
|
145
|
+
display: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.vjs-legacy__sr-only {
|
|
149
|
+
position: absolute;
|
|
150
|
+
width: 1px;
|
|
151
|
+
height: 1px;
|
|
152
|
+
overflow: hidden;
|
|
153
|
+
clip: rect(0, 0, 0, 0);
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.vjs-legacy:fullscreen {
|
|
158
|
+
width: 100%;
|
|
159
|
+
height: 100%;
|
|
160
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/skins/legacy.d.ts
|
|
2
|
+
/** Light-DOM skin. Import videojs-vue/skins/legacy.css separately. */
|
|
3
|
+
export declare const LegacyVideoSkin: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
//#endregion
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { usePlayerState } from "../composables/usePlayerState.js";
|
|
2
|
+
import { MediaContainer } from "../ui/container.js";
|
|
3
|
+
import { LegacyControls } from "./legacy/LegacyControls.js";
|
|
4
|
+
import { useLegacySize } from "./legacy/useLegacySize.js";
|
|
5
|
+
import { defineComponent, h, mergeProps, shallowRef } from "vue";
|
|
6
|
+
//#region src/skins/legacy.ts
|
|
7
|
+
/** Light-DOM skin. Import videojs-vue/skins/legacy.css separately. */
|
|
8
|
+
const LegacyVideoSkin = defineComponent({
|
|
9
|
+
name: "LegacyVideoSkin",
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
setup(_props, { attrs, slots }) {
|
|
12
|
+
const element = shallowRef(null);
|
|
13
|
+
const size = useLegacySize(element);
|
|
14
|
+
const hasStarted = usePlayerState((state) => state.started);
|
|
15
|
+
return () => h(MediaContainer, mergeProps({
|
|
16
|
+
class: "vjs-legacy",
|
|
17
|
+
style: {
|
|
18
|
+
display: "block",
|
|
19
|
+
width: "100%",
|
|
20
|
+
aspectRatio: "16 / 9"
|
|
21
|
+
}
|
|
22
|
+
}, attrs, { "data-size": size.value }), { default: () => {
|
|
23
|
+
var _slots$default;
|
|
24
|
+
return h("div", {
|
|
25
|
+
ref: element,
|
|
26
|
+
class: "vjs-legacy__surface"
|
|
27
|
+
}, [
|
|
28
|
+
(_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots),
|
|
29
|
+
!hasStarted.value && slots["poster"] ? h("div", { class: "vjs-legacy__poster" }, slots["poster"]()) : null,
|
|
30
|
+
h(LegacyControls)
|
|
31
|
+
]);
|
|
32
|
+
} });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
export { LegacyVideoSkin };
|
package/dist/skins/neutral.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "../register/video/neutral-skin.js";
|
|
2
|
+
//#region src/skins/neutral.d.ts
|
|
3
|
+
export declare const NeutralVideoSkin: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
//#endregion
|
package/dist/skins/neutral.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../register/video/neutral-skin.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createVideoSkin } from "./createVideoSkin.js";
|
|
3
3
|
//#region src/skins/neutral.ts
|
|
4
4
|
const NeutralVideoSkin = /* @__PURE__ */ createVideoSkin("NeutralVideoSkin", "video-neutral-skin");
|
|
5
5
|
//#endregion
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VNodeChild } from "vue";
|
|
2
|
+
//#region src/skins/withSlot.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Assign native slots to rendered nodes while retaining keyed fragment groups.
|
|
5
|
+
* @param {VNodeChild} node - Content returned by the Vue slot.
|
|
6
|
+
* @param {string} slot - Native slot name assigned to each rendered child.
|
|
7
|
+
* @returns {VNodeChild} Content with its fragment boundaries and keys preserved.
|
|
8
|
+
*/
|
|
9
|
+
export declare function withSlot(node: VNodeChild, slot: string): VNodeChild;
|
|
10
|
+
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../register/ui/captions-button.js";
|
|
2
|
-
//#region src/ui/
|
|
2
|
+
//#region src/ui/captions-button.d.ts
|
|
3
3
|
export declare const CaptionsButton: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
disabled: {
|
|
5
5
|
readonly type: BooleanConstructor;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { createElementComponent } from "./createElementComponent.js";
|
|
1
2
|
import "../register/ui/captions-button.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
//#region src/ui/CaptionsButton.ts
|
|
3
|
+
import { buttonProps } from "./props.js";
|
|
4
|
+
//#region src/ui/captions-button.ts
|
|
5
5
|
const CaptionsButton = /* @__PURE__ */ createElementComponent("CaptionsButton", "media-captions-button", buttonProps);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { CaptionsButton };
|
package/dist/ui/container.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../register/ui/container.js";
|
|
2
|
-
//#region src/ui/
|
|
2
|
+
//#region src/ui/container.d.ts
|
|
3
3
|
export declare const MediaContainer: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/ui/container.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../register/ui/container.js";
|
|
2
|
-
import {
|
|
3
|
-
//#region src/ui/
|
|
2
|
+
import { createElementComponent } from "./createElementComponent.js";
|
|
3
|
+
//#region src/ui/container.ts
|
|
4
4
|
const MediaContainer = /* @__PURE__ */ createElementComponent("MediaContainer", "media-container", {});
|
|
5
5
|
//#endregion
|
|
6
6
|
export { MediaContainer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../register/ui/controls-content.js";
|
|
2
|
-
//#region src/ui/
|
|
2
|
+
//#region src/ui/controls-content.d.ts
|
|
3
3
|
export declare const MediaControlsContent: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { createElementComponent } from "./createElementComponent.js";
|
|
1
2
|
import "../register/ui/controls-content.js";
|
|
2
|
-
|
|
3
|
-
//#region src/ui/MediaControlsContent.ts
|
|
3
|
+
//#region src/ui/controls-content.ts
|
|
4
4
|
const MediaControlsContent = /* @__PURE__ */ createElementComponent("MediaControlsContent", "media-controls-content", {});
|
|
5
5
|
//#endregion
|
|
6
6
|
export { MediaControlsContent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../register/ui/controls-group.js";
|
|
2
|
-
//#region src/ui/
|
|
2
|
+
//#region src/ui/controls-group.d.ts
|
|
3
3
|
export declare const MediaControlsGroup: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|