@maas/vue-equipment 1.0.0-beta.13 → 1.0.0-beta.15
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/MagicAccordion/src/components/MagicAccordionContent.vue +65 -82
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +2 -2
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +24 -30
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +65 -61
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +41 -45
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +137 -150
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +45 -52
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +80 -82
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +40 -47
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +68 -74
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +22 -38
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +95 -85
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +41 -47
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue +41 -39
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +2 -2
- package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue +23 -34
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue +40 -73
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +1 -1
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +70 -86
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +14 -13
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +263 -303
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +50 -49
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +100 -100
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +41 -69
- package/dist/plugins/MagicMarquee/src/composables/useMagicMarquee.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +54 -59
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +2 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +188 -208
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +3 -3
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +181 -194
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +91 -100
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +83 -85
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +79 -75
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +106 -105
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +54 -60
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +1 -1
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +137 -163
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +9 -8
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +53 -78
- package/dist/plugins/MagicPie/src/components/MagicPie.vue +147 -175
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +49 -65
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +87 -129
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +33 -41
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +99 -109
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +47 -75
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +16 -31
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +43 -44
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +52 -109
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +65 -72
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +154 -225
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +49 -59
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +63 -70
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +29 -33
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +59 -69
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +81 -94
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +52 -70
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +2 -2
- package/package.json +1 -1
- package/dist/plugins/MagicAccordion/demo/data/footer.json +0 -117
- package/dist/plugins/MagicCommand/demo/data/about.json +0 -3
- package/dist/plugins/MagicCommand/demo/data/search.json +0 -594
|
@@ -1,37 +1,22 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="!loaded || !touched" class="magic-player-poster">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
5
8
|
import { inject, toRefs } from "vue";
|
|
6
9
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
7
10
|
import { MagicPlayerInstanceId } from "../symbols";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const { initializeState } = usePlayerState(instanceId);
|
|
18
|
-
const state = initializeState();
|
|
19
|
-
const { loaded, touched } = toRefs(state);
|
|
20
|
-
return (_ctx, _cache) => {
|
|
21
|
-
return _withDirectives((_openBlock(), _createElementBlock(
|
|
22
|
-
"div",
|
|
23
|
-
_hoisted_1,
|
|
24
|
-
[
|
|
25
|
-
_renderSlot(_ctx.$slots, "default")
|
|
26
|
-
],
|
|
27
|
-
512
|
|
28
|
-
/* NEED_PATCH */
|
|
29
|
-
)), [
|
|
30
|
-
[_vShow, !_unref(loaded) || !_unref(touched)]
|
|
31
|
-
]);
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
});
|
|
11
|
+
const instanceId = inject(MagicPlayerInstanceId, void 0);
|
|
12
|
+
if (!instanceId) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"MagicPlayerPoster must be nested inside MagicPlayerProvider."
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
const { initializeState } = usePlayerState(instanceId);
|
|
18
|
+
const state = initializeState();
|
|
19
|
+
const { loaded, touched } = toRefs(state);
|
|
35
20
|
</script>
|
|
36
21
|
|
|
37
22
|
<style>
|
|
@@ -1,55 +1,54 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="player"
|
|
4
|
+
class="magic-player-provider"
|
|
5
|
+
:data-id="id"
|
|
6
|
+
:data-mode="mappedOptions.mode"
|
|
7
|
+
:data-fullscreen="isFullscreen"
|
|
8
|
+
:data-touched="touched"
|
|
9
|
+
:data-playing="playing"
|
|
10
|
+
:data-paused="!playing"
|
|
11
|
+
:data-waiting="waiting"
|
|
12
|
+
:data-loaded="loaded"
|
|
13
|
+
:data-muted="muted"
|
|
14
|
+
@mouseenter="onMouseenter"
|
|
15
|
+
@mouseleave="onMouseleave"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
5
22
|
import { toRefs, provide, onUnmounted } from "vue";
|
|
6
23
|
import defu from "defu";
|
|
7
24
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
8
25
|
import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
|
|
9
26
|
import { defaultOptions } from "../utils/defaultOptions";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
options: { type: Object, required: false }
|
|
27
|
+
const { id, options } = defineProps({
|
|
28
|
+
id: {
|
|
29
|
+
type: null,
|
|
30
|
+
required: true
|
|
15
31
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const state = initializeState();
|
|
20
|
-
const { playing, waiting, muted, loaded, isFullscreen, touched, mouseEntered } = toRefs(state);
|
|
21
|
-
function onMouseenter() {
|
|
22
|
-
mouseEntered.value = true;
|
|
23
|
-
}
|
|
24
|
-
function onMouseleave() {
|
|
25
|
-
mouseEntered.value = false;
|
|
26
|
-
}
|
|
27
|
-
onUnmounted(() => {
|
|
28
|
-
deleteState();
|
|
29
|
-
});
|
|
30
|
-
provide(MagicPlayerInstanceId, __props.id);
|
|
31
|
-
provide(MagicPlayerOptionsKey, mappedOptions);
|
|
32
|
-
return (_ctx, _cache) => {
|
|
33
|
-
return _openBlock(), _createElementBlock("div", {
|
|
34
|
-
ref: "player",
|
|
35
|
-
class: "magic-player-provider",
|
|
36
|
-
"data-id": _ctx.id,
|
|
37
|
-
"data-mode": _unref(mappedOptions).mode,
|
|
38
|
-
"data-fullscreen": _unref(isFullscreen),
|
|
39
|
-
"data-touched": _unref(touched),
|
|
40
|
-
"data-playing": _unref(playing),
|
|
41
|
-
"data-paused": !_unref(playing),
|
|
42
|
-
"data-waiting": _unref(waiting),
|
|
43
|
-
"data-loaded": _unref(loaded),
|
|
44
|
-
"data-muted": _unref(muted),
|
|
45
|
-
onMouseenter,
|
|
46
|
-
onMouseleave
|
|
47
|
-
}, [
|
|
48
|
-
_renderSlot(_ctx.$slots, "default")
|
|
49
|
-
], 40, _hoisted_1);
|
|
50
|
-
};
|
|
32
|
+
options: {
|
|
33
|
+
type: Object,
|
|
34
|
+
required: false
|
|
51
35
|
}
|
|
52
36
|
});
|
|
37
|
+
const mappedOptions = defu(options, defaultOptions);
|
|
38
|
+
const { initializeState, deleteState } = usePlayerState(id);
|
|
39
|
+
const state = initializeState();
|
|
40
|
+
const { playing, waiting, muted, loaded, isFullscreen, touched, mouseEntered } = toRefs(state);
|
|
41
|
+
function onMouseenter() {
|
|
42
|
+
mouseEntered.value = true;
|
|
43
|
+
}
|
|
44
|
+
function onMouseleave() {
|
|
45
|
+
mouseEntered.value = false;
|
|
46
|
+
}
|
|
47
|
+
onUnmounted(() => {
|
|
48
|
+
deleteState();
|
|
49
|
+
});
|
|
50
|
+
provide(MagicPlayerInstanceId, id);
|
|
51
|
+
provide(MagicPlayerOptionsKey, mappedOptions);
|
|
53
52
|
</script>
|
|
54
53
|
|
|
55
54
|
<style>
|
|
@@ -1,12 +1,38 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="track" class="magic-player-timeline">
|
|
3
|
+
<div
|
|
4
|
+
class="magic-player-timeline__target"
|
|
5
|
+
@pointerdown="onPointerdown"
|
|
6
|
+
@pointermove="onPointermove"
|
|
7
|
+
>
|
|
8
|
+
<div class="magic-player-timeline__track">
|
|
9
|
+
<div
|
|
10
|
+
class="magic-player-timeline__thumb"
|
|
11
|
+
:style="{ left: `${scrubbedPercentage}%` }"
|
|
12
|
+
>
|
|
13
|
+
<div class="magic-player-timeline__thumb-handle" />
|
|
14
|
+
</div>
|
|
15
|
+
<div class="magic-player-timeline__inner-track">
|
|
16
|
+
<div
|
|
17
|
+
class="magic-player-timeline__buffered"
|
|
18
|
+
:style="{ left: `${bufferedPercentage}%` }"
|
|
19
|
+
/>
|
|
20
|
+
<div
|
|
21
|
+
v-show="controlsMouseEntered"
|
|
22
|
+
class="magic-player-timeline__seeked"
|
|
23
|
+
:style="{ left: `${seekedPercentage}%` }"
|
|
24
|
+
/>
|
|
25
|
+
<div
|
|
26
|
+
class="magic-player-timeline__scrubbed"
|
|
27
|
+
:style="{ left: `${scrubbedPercentage}%` }"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup>
|
|
10
36
|
import { inject, toRefs } from "vue";
|
|
11
37
|
import { usePlayerControlsApi } from "../composables/private/usePlayerControlsApi";
|
|
12
38
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
@@ -16,105 +42,22 @@ import {
|
|
|
16
42
|
MagicPlayerPopoverRef,
|
|
17
43
|
MagicPlayerBarRef
|
|
18
44
|
} from "../symbols";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
barRef,
|
|
37
|
-
trackRef,
|
|
38
|
-
popoverRef
|
|
39
|
-
});
|
|
40
|
-
return (_ctx, _cache) => {
|
|
41
|
-
return _openBlock(), _createElementBlock(
|
|
42
|
-
"div",
|
|
43
|
-
_hoisted_1,
|
|
44
|
-
[
|
|
45
|
-
_createElementVNode(
|
|
46
|
-
"div",
|
|
47
|
-
{
|
|
48
|
-
class: "magic-player-timeline__target",
|
|
49
|
-
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
50
|
-
(...args) => _unref(onPointerdown) && _unref(onPointerdown)(...args)),
|
|
51
|
-
onPointermove: _cache[1] || (_cache[1] = //@ts-ignore
|
|
52
|
-
(...args) => _unref(onPointermove) && _unref(onPointermove)(...args))
|
|
53
|
-
},
|
|
54
|
-
[
|
|
55
|
-
_createElementVNode("div", _hoisted_2, [
|
|
56
|
-
_createElementVNode(
|
|
57
|
-
"div",
|
|
58
|
-
{
|
|
59
|
-
class: "magic-player-timeline__thumb",
|
|
60
|
-
style: _normalizeStyle({ left: `${_unref(scrubbedPercentage)}%` })
|
|
61
|
-
},
|
|
62
|
-
_cache[2] || (_cache[2] = [
|
|
63
|
-
_createElementVNode(
|
|
64
|
-
"div",
|
|
65
|
-
{ class: "magic-player-timeline__thumb-handle" },
|
|
66
|
-
null,
|
|
67
|
-
-1
|
|
68
|
-
/* HOISTED */
|
|
69
|
-
)
|
|
70
|
-
]),
|
|
71
|
-
4
|
|
72
|
-
/* STYLE */
|
|
73
|
-
),
|
|
74
|
-
_createElementVNode("div", _hoisted_3, [
|
|
75
|
-
_createElementVNode(
|
|
76
|
-
"div",
|
|
77
|
-
{
|
|
78
|
-
class: "magic-player-timeline__buffered",
|
|
79
|
-
style: _normalizeStyle({ left: `${_unref(bufferedPercentage)}%` })
|
|
80
|
-
},
|
|
81
|
-
null,
|
|
82
|
-
4
|
|
83
|
-
/* STYLE */
|
|
84
|
-
),
|
|
85
|
-
_withDirectives(_createElementVNode(
|
|
86
|
-
"div",
|
|
87
|
-
{
|
|
88
|
-
class: "magic-player-timeline__seeked",
|
|
89
|
-
style: _normalizeStyle({ left: `${_unref(seekedPercentage)}%` })
|
|
90
|
-
},
|
|
91
|
-
null,
|
|
92
|
-
4
|
|
93
|
-
/* STYLE */
|
|
94
|
-
), [
|
|
95
|
-
[_vShow, _unref(controlsMouseEntered)]
|
|
96
|
-
]),
|
|
97
|
-
_createElementVNode(
|
|
98
|
-
"div",
|
|
99
|
-
{
|
|
100
|
-
class: "magic-player-timeline__scrubbed",
|
|
101
|
-
style: _normalizeStyle({ left: `${_unref(scrubbedPercentage)}%` })
|
|
102
|
-
},
|
|
103
|
-
null,
|
|
104
|
-
4
|
|
105
|
-
/* STYLE */
|
|
106
|
-
)
|
|
107
|
-
])
|
|
108
|
-
])
|
|
109
|
-
],
|
|
110
|
-
32
|
|
111
|
-
/* NEED_HYDRATION */
|
|
112
|
-
)
|
|
113
|
-
],
|
|
114
|
-
512
|
|
115
|
-
/* NEED_PATCH */
|
|
116
|
-
);
|
|
117
|
-
};
|
|
118
|
-
}
|
|
45
|
+
const instanceId = inject(MagicPlayerInstanceId, void 0);
|
|
46
|
+
if (!instanceId) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
"MagicPlayerPoster must be nested inside MagicPlayerVideoControls or MagicPlayerAudioControls."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const { initializeState } = usePlayerState(instanceId);
|
|
52
|
+
const state = initializeState();
|
|
53
|
+
const { controlsMouseEntered, seekedPercentage, scrubbedPercentage } = toRefs(state);
|
|
54
|
+
const barRef = inject(MagicPlayerBarRef);
|
|
55
|
+
const trackRef = inject(MagicPlayerTrackRef);
|
|
56
|
+
const popoverRef = inject(MagicPlayerPopoverRef);
|
|
57
|
+
const { bufferedPercentage, onPointerdown, onPointermove } = usePlayerControlsApi({
|
|
58
|
+
id: instanceId,
|
|
59
|
+
barRef,
|
|
60
|
+
trackRef,
|
|
61
|
+
popoverRef
|
|
119
62
|
});
|
|
120
63
|
</script>
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<video
|
|
3
|
+
ref="el"
|
|
4
|
+
class="magic-player-video"
|
|
5
|
+
playsinline
|
|
6
|
+
disablePictureInPicture
|
|
7
|
+
:preload="injectedOptions.preload"
|
|
8
|
+
:loop="injectedOptions.loop"
|
|
9
|
+
:muted="muted"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
5
14
|
import {
|
|
6
15
|
toRefs,
|
|
7
16
|
useTemplateRef,
|
|
@@ -20,77 +29,61 @@ import { usePlayerMediaApi } from "../composables/private/usePlayerMediaApi";
|
|
|
20
29
|
import { usePlayerRuntime } from "../composables/private/usePlayerRuntime";
|
|
21
30
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
22
31
|
import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
32
|
+
const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
|
|
33
|
+
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
34
|
+
if (!injectedInstanceId) {
|
|
35
|
+
throw new Error("MagicPlayerVideo must be used within a MagicPlayerProvider");
|
|
36
|
+
}
|
|
37
|
+
if (!injectedOptions) {
|
|
38
|
+
throw new Error("MagicPlayerVideo must be used within a MagicPlayerProvider");
|
|
39
|
+
}
|
|
40
|
+
const elRef = useTemplateRef("el");
|
|
41
|
+
const isVisible = useElementVisibility(elRef);
|
|
42
|
+
const { initialize, destroy } = usePlayerRuntime({
|
|
43
|
+
id: injectedInstanceId,
|
|
44
|
+
mediaRef: elRef,
|
|
45
|
+
src: injectedOptions.src,
|
|
46
|
+
srcType: injectedOptions.srcType
|
|
47
|
+
});
|
|
48
|
+
const { initializeState } = usePlayerState(injectedInstanceId);
|
|
49
|
+
const state = initializeState();
|
|
50
|
+
const { muted, playing } = toRefs(state);
|
|
51
|
+
usePlayerMediaApi({
|
|
52
|
+
id: injectedInstanceId,
|
|
53
|
+
mediaRef: elRef
|
|
54
|
+
});
|
|
55
|
+
const { play, pause } = usePlayerVideoApi({
|
|
56
|
+
id: injectedInstanceId,
|
|
57
|
+
videoRef: elRef
|
|
58
|
+
});
|
|
59
|
+
function onWindowFocus() {
|
|
60
|
+
if (isVisible.value && !playing.value && injectedOptions?.autoplay) {
|
|
61
|
+
play();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
useEventListener(defaultWindow, "focus", onWindowFocus);
|
|
65
|
+
watch(
|
|
66
|
+
isVisible,
|
|
67
|
+
(value) => {
|
|
68
|
+
if (value && !playing.value && injectedOptions.autoplay) {
|
|
69
|
+
play();
|
|
70
|
+
} else if (!value && playing.value) {
|
|
71
|
+
pause();
|
|
57
72
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
immediate: true
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
onMounted(() => {
|
|
73
|
-
initialize();
|
|
74
|
-
if (injectedOptions.autoplay) {
|
|
75
|
-
muted.value = true;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
onBeforeUnmount(() => {
|
|
79
|
-
destroy();
|
|
80
|
-
});
|
|
81
|
-
return (_ctx, _cache) => {
|
|
82
|
-
return _openBlock(), _createElementBlock("video", {
|
|
83
|
-
ref: "el",
|
|
84
|
-
class: "magic-player-video",
|
|
85
|
-
playsinline: "",
|
|
86
|
-
disablePictureInPicture: "",
|
|
87
|
-
preload: _unref(injectedOptions).preload,
|
|
88
|
-
loop: _unref(injectedOptions).loop,
|
|
89
|
-
muted: _unref(muted)
|
|
90
|
-
}, null, 8, _hoisted_1);
|
|
91
|
-
};
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
immediate: true
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
onMounted(() => {
|
|
79
|
+
initialize();
|
|
80
|
+
if (injectedOptions.autoplay) {
|
|
81
|
+
muted.value = true;
|
|
92
82
|
}
|
|
93
83
|
});
|
|
84
|
+
onBeforeUnmount(() => {
|
|
85
|
+
destroy();
|
|
86
|
+
});
|
|
94
87
|
</script>
|
|
95
88
|
|
|
96
89
|
<style>
|