@christianriedl/media 1.0.106 → 1.0.107

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/media",
3
- "version": "1.0.106",
3
+ "version": "1.0.107",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -1,17 +1,29 @@
1
1
  <script setup lang="ts">
2
- import { inject, ref, onMounted, onUnmounted } from 'vue';
2
+ import { inject, ref, onMounted, onUnmounted, watch } from 'vue';
3
3
  import { useRoute, useRouter } from 'vue-router';
4
+ import { appStateSymbol } from '@christianriedl/utils';
4
5
  import { MediaService, getMediaSymbol } from '@christianriedl/media';
5
6
 
7
+ const appState = inject(appStateSymbol)!;
6
8
  const getMediaService = inject(getMediaSymbol)!;
7
9
  const mediaService = getMediaService()!;
8
10
  const route = useRoute();
9
11
  const router = useRouter();
10
12
 
11
13
  const url = ref('');
12
- const height = ref(0);
13
14
  const width = ref(0);
14
- let landscape = true;
15
+ const height = ref(0);
16
+ const ready = ref(false);
17
+
18
+ watch(appState.bodyHeight, () => {
19
+ if (appState.pageWidth.value && appState.bodyHeight.value) {
20
+ width.value = appState.pageWidth.value;
21
+ height.value = appState.bodyHeight.value - 8; // video height not exactly, requires 8 px more
22
+ if (url.value)
23
+ ready.value = true;
24
+ }
25
+ }, { immediate: true });
26
+
15
27
  let channelName = "";
16
28
  let media = "";
17
29
 
@@ -24,7 +36,8 @@
24
36
  channelName = route.query.channelName.toString();
25
37
  if (route.query.media)
26
38
  media = route.query.media.toString();
27
- onResize();
39
+ if (height.value)
40
+ ready.value = true;
28
41
  });
29
42
  onUnmounted(() => {
30
43
  window.document.removeEventListener('keydown', onKey);
@@ -32,11 +45,6 @@
32
45
  mediaService.stopSatIpStream(channelName, media);
33
46
  });
34
47
 
35
- function onResize() {
36
- height.value = window.innerHeight;
37
- width.value = window.innerWidth;
38
- landscape = width.value > height.value;
39
- }
40
48
  function onKey(ev: KeyboardEvent) {
41
49
  switch (ev.code) {
42
50
  case "Escape":
@@ -47,8 +55,6 @@
47
55
  </script>
48
56
 
49
57
  <template>
50
- <div v-resize="onResize">
51
- <video controls autoplay :src="url" :width="width" :height="height">
52
- </video>
53
- </div>
58
+ <video v-if="ready" controls autoplay :src="url" :width="width" :height="height">
59
+ </video>
54
60
  </template>
@@ -121,8 +121,7 @@
121
121
  const video = item as IVideoFile;
122
122
  const as = mediaService.splitAudioStreams(video.AudioStreams);
123
123
  audioStreams.splice(0, audioStreams.length, ...as);
124
- params = mediaService.getTranscodeParams(true, video.Width, video.Height, window.innerWidth, quality.value);
125
- paramsText.value = params.text;
124
+ paramsText.value = `${video.Width}x${video.Height}`;
126
125
  return;
127
126
  }
128
127
  const folder = item as IMediaFolder;
@@ -144,7 +143,7 @@
144
143
  }
145
144
  else {
146
145
  params = null;
147
- paramsText.value = "";
146
+ paramsText.value = `${video.Width}x${video.Height}`;
148
147
  }
149
148
  }
150
149
  function listBack() {