@christianriedl/media 1.0.105 → 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.105",
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() {
@@ -204,8 +203,8 @@
204
203
  }
205
204
  }
206
205
  }
207
- async function onShare(item: IMediaItem) {
208
- const url = `https://www.christian-riedl.com/photos/video?media=${item.Url}&videobitrate=`;
206
+ async function onShare(item: IVideoFile) {
207
+ const url = `https://www.christian-riedl.com/photos/video?media=${item.Url}&width=${item.Width}&height=${item.Height}&videobitrate=`;
209
208
  await window.navigator.clipboard.writeText(url);
210
209
  window.alert(`Created and Pasted : ${url} !`);
211
210
  }
@@ -269,7 +268,7 @@
269
268
  <v-img :src="item.ThumbnailUrl"></v-img>
270
269
  </v-avatar>
271
270
  </template>
272
- <template v-slot:append>
271
+ <template v-if="item.Url" v-slot:append>
273
272
  <v-btn color="grey" variant="tonal" icon="$share" @click.stop.prevent="onShare(item)"></v-btn>
274
273
  <v-btn color="grey" variant="tonal" icon="$info" @click.stop.prevent="onInfo(item)"></v-btn>
275
274
  </template>