@christianriedl/media 1.0.276 → 1.0.278

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
  import { IRest } from '@christianriedl/rest';
2
- import { ILogger, Dictionary, InjectionKey } from '@christianriedl/utils';
2
+ import { ILogger, InjectionKey } from '@christianriedl/utils';
3
3
  import { EMediaType } from "./iMedia";
4
4
  export declare enum EPlayState {
5
5
  PowerOff = 0,
@@ -32,14 +32,23 @@ export interface IPlayerCommand {
32
32
  cmd: string;
33
33
  value: string;
34
34
  }
35
+ export interface IPlayerConfiguration {
36
+ playerName: string;
37
+ shortName: string;
38
+ sensorName: string;
39
+ online: boolean;
40
+ playerState: IPlayerState | null;
41
+ }
35
42
  export declare const getPlayerSymbol: InjectionKey<() => PlayerService>;
36
43
  export declare class PlayerService {
37
44
  rest: IRest;
38
45
  mediaUrl: string;
39
46
  log: ILogger;
40
47
  playerNames: string[];
41
- playerStates: Dictionary<IPlayerState>;
42
- constructor(rest: IRest, log: ILogger);
48
+ playerConfigurations: IPlayerConfiguration[];
49
+ currentPlayer?: IPlayerConfiguration;
50
+ getSensorOnline?: (sensorName: string) => boolean | null;
51
+ constructor(rest: IRest, log: ILogger, configs: IPlayerConfiguration[], getSensorOnline?: (sensorName: string) => boolean | null);
43
52
  getPlayers(mediaType?: EMediaType, isReady?: boolean): Promise<string[]>;
44
53
  getPlayerState(playerName: string): Promise<IPlayerState | null>;
45
54
  play(playerRequest: IPlayerRequest): Promise<boolean>;
@@ -48,4 +57,5 @@ export declare class PlayerService {
48
57
  next(playerName: string): Promise<boolean>;
49
58
  previous(playerName: string): Promise<boolean>;
50
59
  command(playerCommand: IPlayerCommand): Promise<boolean>;
60
+ getPlayersOnline(): number;
51
61
  }
@@ -14,11 +14,15 @@ export class PlayerService {
14
14
  mediaUrl;
15
15
  log;
16
16
  playerNames = [];
17
- playerStates = {};
18
- constructor(rest, log) {
17
+ playerConfigurations;
18
+ currentPlayer;
19
+ getSensorOnline;
20
+ constructor(rest, log, configs, getSensorOnline) {
19
21
  this.log = log;
20
22
  this.rest = rest;
21
23
  this.mediaUrl = rest.serviceUrl;
24
+ this.playerConfigurations = configs;
25
+ this.getSensorOnline = getSensorOnline;
22
26
  }
23
27
  async getPlayers(mediaType, isReady) {
24
28
  const query = {};
@@ -28,15 +32,27 @@ export class PlayerService {
28
32
  query.isReady = isReady;
29
33
  const players = await this.rest.getData('apiplayer/players', query);
30
34
  this.playerNames = players.result;
35
+ for (let i = 0; i < this.playerConfigurations.length; i++) {
36
+ const config = this.playerConfigurations[i];
37
+ config.online = this.playerNames.includes(config.playerName);
38
+ }
31
39
  return this.playerNames;
32
40
  }
33
41
  async getPlayerState(playerName) {
34
42
  const result = await this.rest.getData('apiplayer/playstate', { playerName: playerName });
43
+ const config = this.playerConfigurations.find(c => c.playerName === playerName);
35
44
  if (result.ok) {
36
45
  const playerState = result.result;
37
- this.playerStates[playerName] = playerState;
46
+ if (config && playerState && !!playerState.state) {
47
+ config.playerState = playerState;
48
+ config.online = true;
49
+ }
38
50
  return playerState;
39
51
  }
52
+ if (config) {
53
+ config.online = false;
54
+ config.playerState = null;
55
+ }
40
56
  return null;
41
57
  }
42
58
  async play(playerRequest) {
@@ -63,5 +79,18 @@ export class PlayerService {
63
79
  const result = await this.rest.postData('apiplayer/playcommand', playerCommand);
64
80
  return result.ok;
65
81
  }
82
+ getPlayersOnline() {
83
+ let count = 0;
84
+ for (let i = 0; i < this.playerConfigurations.length; i++) {
85
+ const config = this.playerConfigurations[i];
86
+ if (config.sensorName && this.getSensorOnline)
87
+ config.online = this.getSensorOnline(config.sensorName);
88
+ else
89
+ config.online = false;
90
+ if (config.online)
91
+ count++;
92
+ }
93
+ return count;
94
+ }
66
95
  }
67
96
  //# sourceMappingURL=playerService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"playerService.js","sourceRoot":"","sources":["../src/playerService.ts"],"names":[],"mappings":"AAOA,MAAM,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,UAAU,IAAI,IAAI,CAAC,eAAe;gBAChD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;;gBAExD,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;YACnB,IAAI,MAAM,CAAC,MAAM;gBACpB,KAAK,EAAE,CAAC;QACT,CAAC;QACD,OAAO,KAAK,CAAC;IACV,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/media",
3
- "version": "1.0.276",
3
+ "version": "1.0.278",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -5,7 +5,7 @@
5
5
  import { IAppState, IAppConfig, EDevice, EDirection, Dictionary, appStateSymbol, appConfigSymbol } from '@christianriedl/utils';
6
6
  import {
7
7
  EMediaType, EPictureFlags, IPictureFile, IMediaFolder, IMediaService, IMediaAppConfig, EPictureQuality,
8
- MediaHelper, getMediaBinSymbol
8
+ MediaHelper, getMediaBinSymbol, getPlayerSymbol
9
9
  } from '@christianriedl/media';
10
10
 
11
11
  import PhotoMetaData from '../components/PhotoMetaData.vue';
@@ -19,6 +19,8 @@
19
19
  const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
20
20
  const getMediaService = inject(getMediaBinSymbol)!;
21
21
  const mediaService = getMediaService();
22
+ const getPlayerService = inject(getPlayerSymbol)!;
23
+ const playerService = getPlayerService();
22
24
  const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'hidden' } });
23
25
  const isMobile = appState.isMobile;
24
26
  const headerText = ref("");
@@ -366,6 +368,16 @@
366
368
  itemName.value = item.title;
367
369
  nameTimer = window.setTimeout(() => { clearName(); }, mediaAppConfig.nameDurationMS);
368
370
  }
371
+ if (playerService.currentPlayer) {
372
+ const request = {
373
+ playerName: playerService.currentPlayer.playerName,
374
+ folderId: item.dlnaParentId,
375
+ mediaId: item.dlnaid,
376
+ trackNo: -1,
377
+ withStreamTitle: false
378
+ };
379
+ const rc = playerService!.play(request).then(() => {});
380
+ }
369
381
  }
370
382
  function createBlob(item: IPictureFile) {
371
383
  item.blob = appConfig.urlPrefix + "img/Wait.png";
@@ -2,19 +2,24 @@
2
2
  import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch, StyleValue } from 'vue';
3
3
  import type { ComponentPublicInstance } from 'vue';
4
4
  import { useRouter, useRoute } from 'vue-router';
5
- import { IAppState, IAppConfig, EDevice, EBrowser, appStateSymbol, appConfigSymbol, Helper } from '@christianriedl/utils';
6
- import { IRestResult, IValueResult } from '@christianriedl/rest';
7
- import { EItemType, EMediaType, IMediaFolder, IMediaItem, IPhotoSelection, IMediaService,
8
- getMediaBinSymbol, IMediaAppConfig, MediaHelper, LocationHelper
5
+ import { IAppState, IAppConfig, EDevice, EBrowser, appStateSymbol, appConfigSymbol, Helper, EScope } from '@christianriedl/utils';
6
+ import { IRestResult, IValueResult, authorizeSymbol } from '@christianriedl/rest';
7
+ import { EItemType, EMediaType, IMediaFolder, IMediaItem, IPhotoSelection, IMediaService, getMediaBinSymbol,
8
+ IPlayerConfiguration, getPlayerSymbol, IMediaAppConfig, MediaHelper, LocationHelper
9
9
  } from '@christianriedl/media';
10
10
  import FileUpload from '../components/FileUpload.vue';
11
11
  import PhotoDownload from '../components/PhotoDownload.vue';
12
12
 
13
13
  const appState = inject(appStateSymbol)!;
14
14
  const appConfig = inject(appConfigSymbol)!;
15
+ const authorize = inject(authorizeSymbol)!;
15
16
  const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
16
17
  const getMediaService = inject(getMediaBinSymbol)!;
17
- const mediaService = getMediaService() ;
18
+ const mediaService = getMediaService();
19
+ const getPlayerService = inject(getPlayerSymbol)!;
20
+ const playerService = getPlayerService();
21
+ const supportsLocalMedia = authorize.checkScope(EScope.Media);
22
+
18
23
  //const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
19
24
  const isMobile = appState.isMobile && (appState.device != EDevice.iPad);
20
25
  const router = useRouter();
@@ -51,6 +56,15 @@
51
56
  })
52
57
  async function start() {
53
58
  let root: IMediaFolder;
59
+ if (supportsLocalMedia) {
60
+ playerService.getPlayersOnline();
61
+ for (let i = 0; i < playerService.playerConfigurations.length; i++) {
62
+ const config = playerService.playerConfigurations[i];
63
+ if (!config.playerState) {
64
+ playerService.getPlayerState(config.playerName);
65
+ }
66
+ }
67
+ }
54
68
  if (route.query && route.query.id) {
55
69
  const id = decodeURIComponent(route.query.id.toString());
56
70
  root = mediaService.getFolder(id);
@@ -174,6 +188,9 @@
174
188
  async function onSearch() {
175
189
  router.push({ path: 'photothumbnails' });
176
190
  }
191
+ function playTV(config: IPlayerConfiguration) {
192
+ playerService.currentPlayer = config;
193
+ }
177
194
  async function initialize(selectedName?: string) {
178
195
  let root = await mediaService.getPhotosByCriteria(stars(), selected.criteria);
179
196
  if (selected.criteria != 'ye' && selectedName) {
@@ -218,23 +235,28 @@
218
235
  <template>
219
236
  <v-card ref="listhead" class="bg-media_head" density="compact">
220
237
  <v-card-title>{{selectedFolder.name}}</v-card-title>
221
- <v-card-actions>
222
- <v-btn v-if="backVisible" @click="goBack">
223
- <v-icon icon="$back" />
224
- </v-btn>
225
- <v-rating clearable length="2" v-model="selected.rating" @update:modelValue="onRating" />
226
- <v-select v-model="root" :items="roots" density="compact" persistent-hint
227
- @update:modelValue="onRootChange" hide-details single-line>
228
- </v-select>
229
- <v-btn v-if="!backVisible" @click="onSearch">
230
- {{ isMobile ? "" : "SEARCH" }}
231
- <v-icon icon="$search" />
232
- </v-btn>
233
- <v-btn v-if="!isMobile" @click="uploadVisible = !uploadVisible">
234
- UPLOAD
235
- <v-icon icon="$upload" />
236
- </v-btn>
237
- </v-card-actions>
238
+ <v-card-actions>
239
+ <v-btn v-if="backVisible" @click="goBack">
240
+ <v-icon icon="$back" />
241
+ </v-btn>
242
+ <v-rating clearable length="2" v-model="selected.rating" @update:modelValue="onRating" />
243
+ <v-select v-model="root" :items="roots" density="compact" persistent-hint
244
+ @update:modelValue="onRootChange" hide-details single-line>
245
+ </v-select>
246
+ <template v-for="player in playerService.playerConfigurations" :key="player.shortName">
247
+ <v-btn v-if="player.online" @click.stop="playTV(player)" :active="!!player.playerState">
248
+ {{player.shortName}}
249
+ </v-btn>
250
+ </template>
251
+ <v-btn v-if="!backVisible" @click="onSearch">
252
+ {{ isMobile ? "" : "SEARCH" }}
253
+ <v-icon icon="$search" />
254
+ </v-btn>
255
+ <v-btn v-if="!isMobile" @click="uploadVisible = !uploadVisible">
256
+ UPLOAD
257
+ <v-icon icon="$upload" />
258
+ </v-btn>
259
+ </v-card-actions>
238
260
  </v-card>
239
261
  <file-upload v-if="uploadVisible" accept="image/jpeg"></file-upload>
240
262
  <v-card :height="listHeight" class="overflow-y-auto bg-media" >
@@ -5,21 +5,17 @@
5
5
  import { IAppState, EDevice, EScope, appStateSymbol, appConfigSymbol, IValueText } from '@christianriedl/utils';
6
6
  import { Authorize, authorizeSymbol } from '@christianriedl/rest';
7
7
  import { EItemType, EMediaType, IMediaFolder, IMediaItem, IVideoFile, IMediaService, MediaHelper,
8
- getMediaBinSymbol, getPlayerSymbol, IMediaAppConfig, ITranscodeParams
8
+ getMediaBinSymbol, getPlayerSymbol, IMediaAppConfig, ITranscodeParams, IPlayerConfiguration
9
9
  } from '@christianriedl/media';
10
- import { ISensorsState, sensorsStateSymbol } from '@christianriedl/smarthome';
11
10
  import FileUpload from '../components/FileUpload.vue';
12
11
 
13
12
  const appState = inject(appStateSymbol)!;
14
- const sensors = inject(sensorsStateSymbol)!;
15
13
  const authorize = inject(authorizeSymbol)!;
16
14
  const mediaAppConfig = inject(appConfigSymbol)! as unknown as IMediaAppConfig;
17
15
  const getMediaService = inject(getMediaBinSymbol)!;
18
16
  const mediaService = getMediaService() ;
19
17
  const getPlayerService = inject(getPlayerSymbol)!;
20
18
  const playerService = getPlayerService();
21
- const rendererName = "[TV] Samsung Q9 Series (75)";
22
- const showRenderer = ref(false);
23
19
  const supportsLocalMedia = authorize.checkScope(EScope.Media);
24
20
 
25
21
  const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
@@ -105,9 +101,10 @@
105
101
  }
106
102
  router.push({ path: 'video', query: { url: url, media: parSet ? selected.value.url : "" } });
107
103
  }
108
- async function playTV() {
104
+ async function playTV(config: IPlayerConfiguration) {
105
+ playerService.currentPlayer = config;
109
106
  const request = {
110
- playerName: rendererName,
107
+ playerName: config.playerName,
111
108
  folderId: selected.value.dlnaParentId,
112
109
  mediaId: selected.value.dlnaid,
113
110
  trackNo: 0,
@@ -187,21 +184,15 @@
187
184
  }
188
185
  return "";
189
186
  }
190
- function getPlayer() {
191
- if (supportsLocalMedia) {
192
- const samsungTV = sensors.sensors['HomeNetwork.SamsungTV'];
193
- if (samsungTV && samsungTV.values["Online"].value) {
194
- if (!showRenderer.value) {
195
- playerService.getPlayerState(rendererName)
196
- .then((playerState) => {
197
- if (playerState)
198
- showRenderer.value = true;
199
- });
200
- }
201
- }
202
- else {
203
- showRenderer.value = false;
204
- }
187
+ async function getPlayer() {
188
+ if (supportsLocalMedia) {
189
+ playerService.getPlayersOnline();
190
+ for (let i = 0; i < playerService.playerConfigurations.length; i++) {
191
+ const config = playerService.playerConfigurations[i];
192
+ if (!config.playerState) {
193
+ await playerService.getPlayerState(config.playerName);
194
+ }
195
+ }
205
196
  }
206
197
  }
207
198
  async function onShare(item: IMediaItem) {
@@ -304,9 +295,10 @@
304
295
  <v-btn v-if="playVisible" @click.stop="play">
305
296
  <v-icon size="x-large" icon="$play" />
306
297
  </v-btn>
307
- <v-btn v-if="showRenderer && playVisible" @click.stop="playTV">
308
- <v-icon size="x-large" icon="$tv" />
309
- </v-btn>
298
+ <template v-if="playVisible" v-for="player in playerService.playerConfigurations" :key="player.shortName">
299
+ <v-btn v-if="player.online" @click.stop="playTV(player)" :active="!!player.playerState" >{{player.shortName}}
300
+ </v-btn>
301
+ </template>
310
302
  <v-btn v-if="recordedVisible" @click.stop="recorded">
311
303
  <v-icon size="x-large" icon="$recorded" />
312
304
  </v-btn>