@maas/vue-equipment 1.0.0-beta.26 → 1.0.0-beta.27
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/nuxt/module.json +1 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +4 -4
- package/dist/plugins/MagicDrawer/src/utils/defaultOptions.mjs +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +3 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +78 -39
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +12 -6
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +5 -11
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +23 -3
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +10 -9
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +26 -14
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerProvider.d.ts +7 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerProvider.mjs +35 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +10 -8
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +11 -1
- package/dist/plugins/MagicPlayer/src/utils/defaultOptions.mjs +6 -1
- package/package.json +7 -7
package/dist/nuxt/module.json
CHANGED
|
@@ -482,20 +482,20 @@ dialog.magic-drawer__drag::backdrop {
|
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
/* Content */
|
|
485
|
-
.magic-drawer
|
|
485
|
+
.magic-drawer-content-enter-active {
|
|
486
486
|
animation: var(--magic-drawer-enter-animation);
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
.magic-drawer
|
|
489
|
+
.magic-drawer-content-leave-active {
|
|
490
490
|
animation: var(--magic-drawer-leave-animation);
|
|
491
491
|
}
|
|
492
492
|
|
|
493
493
|
/* Backdrop */
|
|
494
|
-
.magic-drawer
|
|
494
|
+
.magic-drawer-backdrop-enter-active {
|
|
495
495
|
animation: fade-in 300ms ease;
|
|
496
496
|
}
|
|
497
497
|
|
|
498
|
-
.magic-drawer
|
|
498
|
+
.magic-drawer-backdrop-leave-active {
|
|
499
499
|
animation: fade-out 300ms ease;
|
|
500
500
|
}
|
|
501
501
|
</style>
|
|
@@ -71,6 +71,7 @@ import IconPlay from "./icons/Play.vue";
|
|
|
71
71
|
import IconPause from "./icons/Pause.vue";
|
|
72
72
|
import {
|
|
73
73
|
MagicPlayerInstanceId,
|
|
74
|
+
MagicPlayerOptionsKey,
|
|
74
75
|
MagicPlayerTrackRef,
|
|
75
76
|
MagicPlayerBarRef
|
|
76
77
|
} from "../symbols";
|
|
@@ -78,6 +79,7 @@ const { instanceId } = defineProps({
|
|
|
78
79
|
instanceId: { type: String, required: false }
|
|
79
80
|
});
|
|
80
81
|
const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
|
|
82
|
+
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
81
83
|
const mappedInstanceId = computed(() => instanceId ?? injectedInstanceId);
|
|
82
84
|
if (!mappedInstanceId.value) {
|
|
83
85
|
throw new Error(
|
|
@@ -105,7 +107,7 @@ const {
|
|
|
105
107
|
touched,
|
|
106
108
|
controlsMouseEntered
|
|
107
109
|
} = toRefs(state);
|
|
108
|
-
const { idle } = useIdle(
|
|
110
|
+
const { idle } = useIdle(injectedOptions?.threshold?.idle);
|
|
109
111
|
initialize();
|
|
110
112
|
onBeforeUnmount(() => {
|
|
111
113
|
destroy();
|
|
@@ -12,47 +12,55 @@
|
|
|
12
12
|
:data-hover="mouseEntered"
|
|
13
13
|
@click.stop="togglePlay"
|
|
14
14
|
>
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
15
|
+
<transition :name="mappedOverlayTransition">
|
|
16
|
+
<div v-if="isVisible">
|
|
17
|
+
<slot>
|
|
18
|
+
<transition :name="mappedIconsTransition">
|
|
19
|
+
<button
|
|
20
|
+
v-if="defferedWaiting && started"
|
|
21
|
+
class="magic-player-overlay__button"
|
|
22
|
+
>
|
|
23
|
+
<slot name="waitingIcon">
|
|
24
|
+
<icon-waiting />
|
|
25
|
+
</slot>
|
|
26
|
+
</button>
|
|
27
|
+
<button
|
|
28
|
+
v-else-if="paused || !started"
|
|
29
|
+
class="magic-player-overlay__button"
|
|
30
|
+
>
|
|
31
|
+
<slot name="playIcon">
|
|
32
|
+
<icon-play />
|
|
33
|
+
</slot>
|
|
34
|
+
</button>
|
|
35
|
+
<button
|
|
36
|
+
v-else-if="started && !paused"
|
|
37
|
+
class="magic-player-overlay__button"
|
|
38
|
+
>
|
|
39
|
+
<slot name="pauseIcon">
|
|
40
|
+
<icon-pause />
|
|
41
|
+
</slot>
|
|
42
|
+
</button>
|
|
43
|
+
</transition>
|
|
44
|
+
</slot>
|
|
45
|
+
</div>
|
|
46
|
+
</transition>
|
|
43
47
|
</div>
|
|
44
48
|
</template>
|
|
45
49
|
|
|
46
50
|
<script setup>
|
|
47
|
-
import { watch, ref, inject, toRefs } from "vue";
|
|
51
|
+
import { watch, ref, computed, inject, toRefs } from "vue";
|
|
48
52
|
import { useIdle } from "@vueuse/core";
|
|
49
53
|
import IconPlay from "./icons/Play.vue";
|
|
50
54
|
import IconPause from "./icons/Pause.vue";
|
|
51
55
|
import IconWaiting from "./icons/Waiting.vue";
|
|
52
56
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
53
57
|
import { usePlayerVideoApi } from "../composables/private/usePlayerVideoApi";
|
|
54
|
-
import { MagicPlayerInstanceId } from "../symbols";
|
|
58
|
+
import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
|
|
59
|
+
const { transition } = defineProps({
|
|
60
|
+
transition: { type: Object, required: false }
|
|
61
|
+
});
|
|
55
62
|
const instanceId = inject(MagicPlayerInstanceId, void 0);
|
|
63
|
+
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
56
64
|
if (!instanceId) {
|
|
57
65
|
throw new Error(
|
|
58
66
|
"MagicPlayerOverlay must be nested inside MagicPlayerProvider."
|
|
@@ -72,10 +80,26 @@ const {
|
|
|
72
80
|
hasOverlay
|
|
73
81
|
} = toRefs(state);
|
|
74
82
|
hasOverlay.value = true;
|
|
83
|
+
const mappedOverlayTransition = computed(
|
|
84
|
+
() => transition?.overlay ?? injectedOptions?.transition?.overlay
|
|
85
|
+
);
|
|
86
|
+
const mappedIconsTransition = computed(
|
|
87
|
+
() => transition?.icons ?? injectedOptions?.transition?.icons
|
|
88
|
+
);
|
|
75
89
|
const { togglePlay } = usePlayerVideoApi({
|
|
76
90
|
id: instanceId
|
|
77
91
|
});
|
|
78
|
-
const { idle } = useIdle(
|
|
92
|
+
const { idle } = useIdle(injectedOptions?.threshold?.idle);
|
|
93
|
+
const isVisible = computed(() => {
|
|
94
|
+
switch (true) {
|
|
95
|
+
case (playing.value && idle.value):
|
|
96
|
+
case (playing.value && !mouseEntered.value):
|
|
97
|
+
case (injectedOptions?.autoplay && (!started.value || !mouseEntered.value)):
|
|
98
|
+
return false;
|
|
99
|
+
default:
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
79
103
|
const defferedWaiting = ref(false);
|
|
80
104
|
watch(
|
|
81
105
|
() => waiting.value,
|
|
@@ -100,11 +124,16 @@ watch(
|
|
|
100
124
|
inset: 0;
|
|
101
125
|
background-color: var(--magic-player-overlay-background, rgba(0, 0, 0, 0.3));
|
|
102
126
|
color: var(--magic-player-overlay-color, rgba(255, 255, 255, 1));
|
|
103
|
-
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.magic-player-overlay div {
|
|
131
|
+
position: relative;
|
|
132
|
+
width: 100%;
|
|
133
|
+
height: 100%;
|
|
104
134
|
display: flex;
|
|
105
135
|
align-items: center;
|
|
106
136
|
justify-content: center;
|
|
107
|
-
cursor: pointer;
|
|
108
137
|
}
|
|
109
138
|
|
|
110
139
|
.magic-player-overlay__button {
|
|
@@ -116,15 +145,25 @@ watch(
|
|
|
116
145
|
outline: none;
|
|
117
146
|
appearance: none;
|
|
118
147
|
cursor: pointer;
|
|
119
|
-
width: var(--magic-player-overlay-button-size,
|
|
120
|
-
height: var(--magic-player-overlay-button-size,
|
|
148
|
+
width: var(--magic-player-overlay-button-size, 2rem);
|
|
149
|
+
height: var(--magic-player-overlay-button-size, 2rem);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.magic-player-overlay-enter-active {
|
|
153
|
+
animation: fade-in 150ms ease;
|
|
121
154
|
}
|
|
122
155
|
|
|
123
|
-
.magic-player-overlay
|
|
124
|
-
|
|
156
|
+
.magic-player-overlay-leave-active {
|
|
157
|
+
animation: fade-out 150ms ease;
|
|
125
158
|
}
|
|
126
159
|
|
|
127
|
-
.magic-player-
|
|
128
|
-
|
|
160
|
+
.magic-player-icons-enter-active {
|
|
161
|
+
animation: none;
|
|
162
|
+
position: absolute;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.magic-player-icons-leave-active {
|
|
166
|
+
animation: none;
|
|
167
|
+
position: absolute;
|
|
129
168
|
}
|
|
130
169
|
</style>
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
interface MagicPlayerOverlayProps {
|
|
2
|
+
transition?: {
|
|
3
|
+
overlay?: string;
|
|
4
|
+
icons?: string;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
declare var __VLS_5: {}, __VLS_11: {}, __VLS_16: {}, __VLS_21: {};
|
|
2
8
|
type __VLS_Slots = {} & {
|
|
3
|
-
default?: (props: typeof
|
|
9
|
+
default?: (props: typeof __VLS_5) => any;
|
|
4
10
|
} & {
|
|
5
|
-
waitingIcon?: (props: typeof
|
|
11
|
+
waitingIcon?: (props: typeof __VLS_11) => any;
|
|
6
12
|
} & {
|
|
7
|
-
playIcon?: (props: typeof
|
|
13
|
+
playIcon?: (props: typeof __VLS_16) => any;
|
|
8
14
|
} & {
|
|
9
|
-
pauseIcon?: (props: typeof
|
|
15
|
+
pauseIcon?: (props: typeof __VLS_21) => any;
|
|
10
16
|
};
|
|
11
|
-
declare const __VLS_component: import("vue").DefineComponent<
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicPlayerOverlayProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicPlayerOverlayProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
18
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
13
19
|
export default _default;
|
|
14
20
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
:data-waiting="waiting"
|
|
13
13
|
:data-loaded="loaded"
|
|
14
14
|
:data-muted="muted"
|
|
15
|
+
@touchstart="onTouchstart"
|
|
15
16
|
@mouseenter="onMouseenter"
|
|
16
17
|
@mouseleave="onMouseleave"
|
|
17
18
|
@pointerdown="onPointerdown"
|
|
@@ -37,6 +38,7 @@ import {
|
|
|
37
38
|
} from "../symbols";
|
|
38
39
|
import { defaultOptions } from "../utils/defaultOptions";
|
|
39
40
|
import { usePlayerEmitter } from "../composables/private/usePlayerEmitter";
|
|
41
|
+
import { usePlayerProvider } from "../composables/private/usePlayerProvider";
|
|
40
42
|
const { id, options } = defineProps({
|
|
41
43
|
id: { type: null, required: true },
|
|
42
44
|
options: { type: Object, required: false }
|
|
@@ -53,19 +55,11 @@ const {
|
|
|
53
55
|
loaded,
|
|
54
56
|
fullscreen,
|
|
55
57
|
touched,
|
|
56
|
-
|
|
58
|
+
hasOverlay
|
|
57
59
|
} = toRefs(state);
|
|
58
|
-
const {
|
|
60
|
+
const { onTouchstart, onMouseenter, onMouseleave, onPointerdown } = usePlayerProvider(id);
|
|
59
61
|
const playerRef = useTemplateRef("player");
|
|
60
|
-
|
|
61
|
-
mouseEntered.value = true;
|
|
62
|
-
}
|
|
63
|
-
function onMouseleave() {
|
|
64
|
-
mouseEntered.value = false;
|
|
65
|
-
}
|
|
66
|
-
function onPointerdown() {
|
|
67
|
-
touched.value = true;
|
|
68
|
-
}
|
|
62
|
+
const { initializeEmitter } = usePlayerEmitter({ id });
|
|
69
63
|
onMounted(() => {
|
|
70
64
|
initializeEmitter();
|
|
71
65
|
});
|
|
@@ -54,7 +54,7 @@ const { initialize, destroy } = usePlayerRuntime({
|
|
|
54
54
|
});
|
|
55
55
|
const { initializeState } = usePlayerState(injectedInstanceId);
|
|
56
56
|
const state = initializeState();
|
|
57
|
-
const { muted, playing, started } = toRefs(state);
|
|
57
|
+
const { muted, playing, started, loaded } = toRefs(state);
|
|
58
58
|
usePlayerMediaApi({
|
|
59
59
|
id: injectedInstanceId,
|
|
60
60
|
mediaRef: elRef
|
|
@@ -100,9 +100,29 @@ if (manageViewport.value) {
|
|
|
100
100
|
play();
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
+
watch(
|
|
104
|
+
loaded,
|
|
105
|
+
(value) => {
|
|
106
|
+
if (value && !started.value && isVisible.value && injectedOptions.autoplay) {
|
|
107
|
+
play();
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{ once: true }
|
|
111
|
+
);
|
|
103
112
|
}
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
if (!manageViewport.value) {
|
|
114
|
+
watch(
|
|
115
|
+
loaded,
|
|
116
|
+
(value) => {
|
|
117
|
+
if (value && !started.value && injectedOptions.autoplay) {
|
|
118
|
+
play();
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{ once: true }
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
onMounted(async () => {
|
|
125
|
+
initialize(injectedOptions.autoplay);
|
|
106
126
|
initializeFullscreen();
|
|
107
127
|
if (injectedOptions.autoplay) {
|
|
108
128
|
mute();
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
@mouseleave="onMouseleave"
|
|
17
17
|
>
|
|
18
18
|
<transition :name="mappedTransition">
|
|
19
|
-
<div v-show="
|
|
19
|
+
<div v-show="visible" class="magic-player-video-controls__bar">
|
|
20
20
|
<div
|
|
21
21
|
v-if="$slots.popover"
|
|
22
22
|
v-show="!!seekedTime && touched"
|
|
@@ -114,13 +114,13 @@ const {
|
|
|
114
114
|
transition: { type: String, required: false }
|
|
115
115
|
});
|
|
116
116
|
const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
|
|
117
|
+
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
117
118
|
const mappedInstanceId = computed(() => id ?? injectedInstanceId);
|
|
118
119
|
if (!mappedInstanceId.value) {
|
|
119
120
|
throw new Error(
|
|
120
121
|
"MagicPlayerVideoControls must be nested inside MagicPlayerProvider or be passed an id as a prop."
|
|
121
122
|
);
|
|
122
123
|
}
|
|
123
|
-
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
124
124
|
const mappedTransition = computed(
|
|
125
125
|
() => transition ?? injectedOptions?.transition?.videoControls
|
|
126
126
|
);
|
|
@@ -152,18 +152,19 @@ const { initialize, destroy, onMouseenter, onMouseleave } = usePlayerControlsApi
|
|
|
152
152
|
});
|
|
153
153
|
const elRef = useTemplateRef("el");
|
|
154
154
|
const isVisible = useElementVisibility(elRef);
|
|
155
|
-
const { idle } = useIdle(
|
|
156
|
-
const
|
|
155
|
+
const { idle } = useIdle(injectedOptions?.threshold?.idle);
|
|
156
|
+
const visible = computed(() => {
|
|
157
157
|
switch (true) {
|
|
158
158
|
case standalone:
|
|
159
|
-
return
|
|
159
|
+
return true;
|
|
160
160
|
case !isVisible.value:
|
|
161
|
+
case (hasOverlay.value && !started.value):
|
|
161
162
|
case (playing.value && idle.value):
|
|
162
|
-
case (
|
|
163
|
-
case (
|
|
164
|
-
return true;
|
|
165
|
-
default:
|
|
163
|
+
case (playing.value && !mouseEntered.value && !controlsMouseEntered.value):
|
|
164
|
+
case (injectedOptions?.autoplay && (!started.value || !mouseEntered.value)):
|
|
166
165
|
return false;
|
|
166
|
+
default:
|
|
167
|
+
return true;
|
|
167
168
|
}
|
|
168
169
|
});
|
|
169
170
|
initialize();
|
|
@@ -11,6 +11,7 @@ export function usePlayerMediaApi(args) {
|
|
|
11
11
|
seeking,
|
|
12
12
|
volume,
|
|
13
13
|
rate,
|
|
14
|
+
loaded,
|
|
14
15
|
waiting,
|
|
15
16
|
started,
|
|
16
17
|
ended,
|
|
@@ -28,18 +29,21 @@ export function usePlayerMediaApi(args) {
|
|
|
28
29
|
}
|
|
29
30
|
watch(volume, () => {
|
|
30
31
|
const el = toValue(mediaRef);
|
|
31
|
-
if (
|
|
32
|
-
|
|
32
|
+
if (el) {
|
|
33
|
+
el.volume = volume.value;
|
|
34
|
+
}
|
|
33
35
|
});
|
|
34
36
|
watch(muted, () => {
|
|
35
37
|
const el = toValue(mediaRef);
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
+
if (el) {
|
|
39
|
+
el.muted = muted.value;
|
|
40
|
+
}
|
|
38
41
|
});
|
|
39
42
|
watch(rate, () => {
|
|
40
43
|
const el = toValue(mediaRef);
|
|
41
|
-
if (
|
|
42
|
-
|
|
44
|
+
if (el) {
|
|
45
|
+
el.playbackRate = rate.value;
|
|
46
|
+
}
|
|
43
47
|
});
|
|
44
48
|
if (toValue(mediaRef)) {
|
|
45
49
|
watch([mediaRef], () => {
|
|
@@ -51,27 +55,35 @@ export function usePlayerMediaApi(args) {
|
|
|
51
55
|
}
|
|
52
56
|
});
|
|
53
57
|
}
|
|
58
|
+
watch(loaded, () => {
|
|
59
|
+
if (playing.value) {
|
|
60
|
+
const el = toValue(mediaRef);
|
|
61
|
+
if (el) {
|
|
62
|
+
el.play();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
54
66
|
const { ignoreUpdates: ignoreCurrentTimeUpdates } = watchIgnorable(
|
|
55
67
|
currentTime,
|
|
56
68
|
(time) => {
|
|
57
69
|
const el = toValue(mediaRef);
|
|
58
|
-
if (
|
|
59
|
-
|
|
70
|
+
if (el) {
|
|
71
|
+
el.currentTime = unref(time);
|
|
72
|
+
}
|
|
60
73
|
}
|
|
61
74
|
);
|
|
62
75
|
const { ignoreUpdates: ignorePlayingUpdates } = watchIgnorable(
|
|
63
76
|
playing,
|
|
64
|
-
(
|
|
77
|
+
(value) => {
|
|
65
78
|
const el = toValue(mediaRef);
|
|
66
79
|
if (!el) {
|
|
67
80
|
return;
|
|
68
81
|
}
|
|
69
|
-
if (
|
|
82
|
+
if (value) {
|
|
70
83
|
const playPromise = el.play();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
84
|
+
playPromise?.catch(() => {
|
|
85
|
+
playing.value = false;
|
|
86
|
+
});
|
|
75
87
|
} else {
|
|
76
88
|
el.pause();
|
|
77
89
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { toRefs } from "vue";
|
|
2
|
+
import { useEventListener } from "@vueuse/core";
|
|
3
|
+
import { usePlayerState } from "./usePlayerState.mjs";
|
|
4
|
+
export function usePlayerProvider(id) {
|
|
5
|
+
const { initializeState } = usePlayerState(id);
|
|
6
|
+
const state = initializeState();
|
|
7
|
+
const { mouseEntered, touched } = toRefs(state);
|
|
8
|
+
let cancelTouchend = void 0;
|
|
9
|
+
function onTouchend() {
|
|
10
|
+
cancelTouchend?.();
|
|
11
|
+
cancelTouchend = void 0;
|
|
12
|
+
mouseEntered.value = false;
|
|
13
|
+
}
|
|
14
|
+
function onTouchstart() {
|
|
15
|
+
mouseEntered.value = true;
|
|
16
|
+
cancelTouchend = useEventListener(document, "touchend", onTouchend, {
|
|
17
|
+
passive: true
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function onMouseenter() {
|
|
21
|
+
mouseEntered.value = true;
|
|
22
|
+
}
|
|
23
|
+
function onMouseleave() {
|
|
24
|
+
mouseEntered.value = false;
|
|
25
|
+
}
|
|
26
|
+
function onPointerdown() {
|
|
27
|
+
touched.value = true;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
onTouchstart,
|
|
31
|
+
onMouseenter,
|
|
32
|
+
onMouseleave,
|
|
33
|
+
onPointerdown
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -7,7 +7,7 @@ export type UsePlayerRuntimeArgs = {
|
|
|
7
7
|
src?: string;
|
|
8
8
|
};
|
|
9
9
|
export declare function usePlayerRuntime(args: UsePlayerRuntimeArgs): {
|
|
10
|
-
initialize: () => void;
|
|
10
|
+
initialize: (autoplay?: boolean) => void;
|
|
11
11
|
destroy: () => void;
|
|
12
12
|
};
|
|
13
13
|
export type UsePlayerRuntimeReturn = ReturnType<typeof usePlayerRuntime>;
|
|
@@ -10,7 +10,9 @@ export function usePlayerRuntime(args) {
|
|
|
10
10
|
const { loaded } = toRefs(state);
|
|
11
11
|
function useNative() {
|
|
12
12
|
const el = toValue(mediaRef);
|
|
13
|
-
if (!el || !src)
|
|
13
|
+
if (!el || !src) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
14
16
|
el.src = src;
|
|
15
17
|
el.addEventListener(
|
|
16
18
|
"loadeddata",
|
|
@@ -20,12 +22,12 @@ export function usePlayerRuntime(args) {
|
|
|
20
22
|
{ once: true }
|
|
21
23
|
);
|
|
22
24
|
}
|
|
23
|
-
async function useHlsJS() {
|
|
25
|
+
async function useHlsJS(autoplay = false) {
|
|
24
26
|
const el = toValue(mediaRef);
|
|
25
|
-
if (!el)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if (!el) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
deferredLoading.value = autoplay;
|
|
29
31
|
const { default: Hls } = await import("hls.js");
|
|
30
32
|
hls = new Hls({ autoStartLoad: false });
|
|
31
33
|
if (!Hls.isSupported()) {
|
|
@@ -52,11 +54,11 @@ export function usePlayerRuntime(args) {
|
|
|
52
54
|
hls.attachMedia(el);
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
|
-
function initialize() {
|
|
57
|
+
function initialize(autoplay = false) {
|
|
56
58
|
if (srcType === "native") {
|
|
57
59
|
useNative();
|
|
58
60
|
} else if (srcType === "hls") {
|
|
59
|
-
useHlsJS();
|
|
61
|
+
useHlsJS(autoplay);
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
function destroy() {
|
|
@@ -8,7 +8,12 @@ export interface MagicPlayerOptions {
|
|
|
8
8
|
playback?: ('viewport' | 'window')[] | false;
|
|
9
9
|
loop?: boolean;
|
|
10
10
|
transition?: {
|
|
11
|
-
videoControls
|
|
11
|
+
videoControls?: string;
|
|
12
|
+
overlay?: string;
|
|
13
|
+
icons?: string;
|
|
14
|
+
};
|
|
15
|
+
threshold?: {
|
|
16
|
+
idle?: number;
|
|
12
17
|
};
|
|
13
18
|
}
|
|
14
19
|
export interface RequiredMagicPlayerOptions {
|
|
@@ -20,6 +25,11 @@ export interface RequiredMagicPlayerOptions {
|
|
|
20
25
|
loop: boolean;
|
|
21
26
|
transition: {
|
|
22
27
|
videoControls: string;
|
|
28
|
+
overlay: string;
|
|
29
|
+
icons: string;
|
|
30
|
+
};
|
|
31
|
+
threshold: {
|
|
32
|
+
idle: number;
|
|
23
33
|
};
|
|
24
34
|
}
|
|
25
35
|
export type Buffered = [number, number][];
|
|
@@ -6,7 +6,12 @@ const defaultOptions = {
|
|
|
6
6
|
autoplay: false,
|
|
7
7
|
loop: false,
|
|
8
8
|
transition: {
|
|
9
|
-
videoControls: "magic-player-video-controls"
|
|
9
|
+
videoControls: "magic-player-video-controls",
|
|
10
|
+
overlay: "magic-player-overlay",
|
|
11
|
+
icons: "magic-player-icons"
|
|
12
|
+
},
|
|
13
|
+
threshold: {
|
|
14
|
+
idle: 3e3
|
|
10
15
|
}
|
|
11
16
|
};
|
|
12
17
|
export { defaultOptions };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maas/vue-equipment",
|
|
3
3
|
"description": "Our Frontend Toolkit, Free and Open Source",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.27",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Robin Scholz",
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@maas/config": "^1.6.0",
|
|
17
17
|
"@maas/mirror": "catalog:",
|
|
18
|
-
"@release-it/bumper": "^7.0.
|
|
18
|
+
"@release-it/bumper": "^7.0.5",
|
|
19
19
|
"@types/node": "catalog:",
|
|
20
|
-
"eslint": "^9.
|
|
20
|
+
"eslint": "^9.26.0",
|
|
21
21
|
"prettier": "catalog:",
|
|
22
22
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
23
23
|
"release-it": "^18.1.2",
|
|
24
24
|
"tailwindcss": "catalog:",
|
|
25
|
-
"turbo": "^2.5.
|
|
25
|
+
"turbo": "^2.5.2",
|
|
26
26
|
"typescript": "catalog:"
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"types": "./dist/plugins/index.d.ts",
|
|
39
39
|
"import": "./dist/plugins/index.mjs"
|
|
40
40
|
},
|
|
41
|
-
"./plugins/MagicPlayer/css": {
|
|
42
|
-
"import": "./dist/plugins/MagicPlayer/src/css"
|
|
41
|
+
"./plugins/MagicPlayer/css/*.css": {
|
|
42
|
+
"import": "./dist/plugins/MagicPlayer/src/css/*.css"
|
|
43
43
|
},
|
|
44
44
|
"./utils": {
|
|
45
45
|
"types": "./dist/utils/index.d.mts",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"volta": {
|
|
143
143
|
"node": "20.18.1"
|
|
144
144
|
},
|
|
145
|
-
"packageManager": "pnpm@10.
|
|
145
|
+
"packageManager": "pnpm@10.10.0",
|
|
146
146
|
"pnpm": {
|
|
147
147
|
"overrides": {
|
|
148
148
|
"typescript": "catalog:"
|