@maas/vue-equipment 0.21.2 → 0.21.3

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment/nuxt",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.21.1"
4
+ "version": "0.21.2"
5
5
  }
@@ -19,7 +19,7 @@
19
19
  </template>
20
20
 
21
21
  <script setup lang="ts">
22
- import { ref, computed, onMounted } from 'vue'
22
+ import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
23
23
  import { useIntersectionObserver } from '@vueuse/core'
24
24
  import { usePlayerVideoApi } from '../composables/private/usePlayerVideoApi'
25
25
  import { usePlayerMediaApi } from '../composables/private/usePlayerMediaApi'
@@ -54,7 +54,7 @@ const { playing, muted } = usePlayerMediaApi({
54
54
  mediaRef: videoRef,
55
55
  })
56
56
 
57
- usePlayerRuntime({
57
+ const { initialize, destroy } = usePlayerRuntime({
58
58
  id: props.id,
59
59
  mediaRef: videoRef,
60
60
  src: props.src,
@@ -100,10 +100,15 @@ const computedStyle = computed(() => {
100
100
  })
101
101
 
102
102
  onMounted(() => {
103
+ initialize()
103
104
  if (props.autoplay) {
104
105
  muted.value = true
105
106
  }
106
107
  })
108
+
109
+ onBeforeUnmount(() => {
110
+ destroy()
111
+ })
107
112
  </script>
108
113
 
109
114
  <style>
@@ -15,10 +15,10 @@ export function usePlayerControlsApi(args) {
15
15
  const popoverRect = ref(void 0);
16
16
  const { trackRef, barRef, popoverRef } = args;
17
17
  const { buffered, duration, playing, currentTime } = usePlayerMediaApi({
18
- id: toValue(args.id)
18
+ id: args.id
19
19
  });
20
20
  const { play, pause, seek } = usePlayerVideoApi({
21
- id: toValue(args.id)
21
+ id: args.id
22
22
  });
23
23
  const dragging = ref(false);
24
24
  const mouseEntered = ref(false);
@@ -8,5 +8,7 @@ export type UsePlayerRuntimeArgs = {
8
8
  };
9
9
  export declare function usePlayerRuntime(args: UsePlayerRuntimeArgs): {
10
10
  loaded: import("vue").Ref<boolean>;
11
+ initialize: () => void;
12
+ destroy: () => void;
11
13
  };
12
14
  export type UsePlayerRuntimeReturn = ReturnType<typeof usePlayerRuntime>;
@@ -1,4 +1,4 @@
1
- import { ref, watch, onMounted, onUnmounted, toValue } from "vue";
1
+ import { ref, watch, toValue } from "vue";
2
2
  import { usePlayerStateEmitter } from "./usePlayerStateEmitter.mjs";
3
3
  export function usePlayerRuntime(args) {
4
4
  let hls;
@@ -34,16 +34,16 @@ export function usePlayerRuntime(args) {
34
34
  });
35
35
  }
36
36
  };
37
- onMounted(() => {
37
+ function initialize() {
38
38
  if (srcType === "native") {
39
39
  useNative();
40
40
  } else if (srcType === "hls") {
41
41
  useHlsJS();
42
42
  }
43
- });
44
- onUnmounted(() => {
43
+ }
44
+ function destroy() {
45
45
  hls?.destroy();
46
- });
46
+ }
47
47
  const emitter = usePlayerStateEmitter();
48
48
  emitter.on("update", (payload) => {
49
49
  if (payload.id !== toValue(args.id))
@@ -65,6 +65,8 @@ export function usePlayerRuntime(args) {
65
65
  });
66
66
  });
67
67
  return {
68
- loaded
68
+ loaded,
69
+ initialize,
70
+ destroy
69
71
  };
70
72
  }
@@ -1,13 +1,13 @@
1
- import { type MaybeRef, type Ref } from 'vue';
1
+ import { type MaybeRef } from 'vue';
2
2
  export type UsePlayerVideoApiArgs = {
3
3
  id: MaybeRef<string>;
4
4
  playerRef?: MaybeRef<HTMLElement | undefined>;
5
5
  videoRef?: MaybeRef<HTMLVideoElement | undefined>;
6
6
  };
7
7
  export declare function usePlayerVideoApi(args: UsePlayerVideoApiArgs): {
8
- mouseEntered: Ref<boolean>;
9
- isFullscreen: Ref<boolean>;
10
- touched: Ref<boolean>;
8
+ mouseEntered: import("vue").Ref<boolean>;
9
+ isFullscreen: import("vue").Ref<boolean>;
10
+ touched: import("vue").Ref<boolean>;
11
11
  play: () => void;
12
12
  pause: () => void;
13
13
  togglePlay: () => void;
@@ -6,7 +6,7 @@ import { usePlayerMediaApi } from "./usePlayerMediaApi.mjs";
6
6
  export function usePlayerVideoApi(args) {
7
7
  const fullscreenTarget = ref(void 0);
8
8
  const { playing, currentTime, muted } = usePlayerMediaApi({
9
- id: toValue(args.id)
9
+ id: args.id
10
10
  });
11
11
  const { playerRef, videoRef } = args;
12
12
  const touched = ref(false);
@@ -59,6 +59,9 @@ export declare function usePlayerApi(args: usePlayerApiArgs): {
59
59
  };
60
60
  playerRuntime: {
61
61
  loaded: import("vue").Ref<boolean>;
62
+ initialize: () => void;
63
+ destroy: () => void;
62
64
  };
63
65
  };
66
+ export type UsePlayerApiApiReturn = ReturnType<typeof usePlayerApi>;
64
67
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment",
3
3
  "description": "A magic collection of Vue composables, plugins, components and directives",
4
- "version": "0.21.2",
4
+ "version": "0.21.3",
5
5
  "author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
6
6
  "devDependencies": {
7
7
  "@antfu/ni": "^0.21.12",