@christianriedl/media 1.0.278 → 1.0.280

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.
@@ -57,5 +57,5 @@ export declare class PlayerService {
57
57
  next(playerName: string): Promise<boolean>;
58
58
  previous(playerName: string): Promise<boolean>;
59
59
  command(playerCommand: IPlayerCommand): Promise<boolean>;
60
- getPlayersOnline(): number;
60
+ getPlayersOnline(checkState?: boolean): number;
61
61
  }
@@ -1,3 +1,4 @@
1
+ import { Helper } from '@christianriedl/utils';
1
2
  export var EPlayState;
2
3
  (function (EPlayState) {
3
4
  EPlayState[EPlayState["PowerOff"] = 0] = "PowerOff";
@@ -43,11 +44,14 @@ export class PlayerService {
43
44
  const config = this.playerConfigurations.find(c => c.playerName === playerName);
44
45
  if (result.ok) {
45
46
  const playerState = result.result;
46
- if (config && playerState && !!playerState.state) {
47
- config.playerState = playerState;
48
- config.online = true;
47
+ if (playerState) {
48
+ playerState.state = Helper.stringToEnum(EPlayState, playerState.state);
49
+ if (config) {
50
+ config.playerState = playerState;
51
+ config.online = playerState.state != EPlayState.PowerOff;
52
+ }
53
+ return playerState;
49
54
  }
50
- return playerState;
51
55
  }
52
56
  if (config) {
53
57
  config.online = false;
@@ -79,7 +83,7 @@ export class PlayerService {
79
83
  const result = await this.rest.postData('apiplayer/playcommand', playerCommand);
80
84
  return result.ok;
81
85
  }
82
- getPlayersOnline() {
86
+ getPlayersOnline(checkState) {
83
87
  let count = 0;
84
88
  for (let i = 0; i < this.playerConfigurations.length; i++) {
85
89
  const config = this.playerConfigurations[i];
@@ -89,6 +93,10 @@ export class PlayerService {
89
93
  config.online = false;
90
94
  if (config.online)
91
95
  count++;
96
+ if (checkState) {
97
+ config.playerState = null;
98
+ this.getPlayerState(config.playerName).then(playerState => { }).catch(err => { });
99
+ }
92
100
  }
93
101
  return count;
94
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"playerService.js","sourceRoot":"","sources":["../src/playerService.ts"],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,OAAO,MAAM,CAAC,EAAE,CAAC;IACrB,CAAC;IACD,gBAAgB,CAAC,UAAoB;QACxC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxD,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,MAAM,CAAC,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;YAEL,IAAI,UAAU,EAAE,CAAC;gBACpB,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC;gBAC1B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC/E,CAAC;QACL,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.278",
3
+ "version": "1.0.280",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -18,8 +18,8 @@
18
18
  "author": "Christian Riedl",
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
- "@christianriedl/utils": "^1.0.167",
22
- "@christianriedl/rest": "^1.0.87",
21
+ "@christianriedl/utils": "^1.0.168",
22
+ "@christianriedl/rest": "^1.0.89",
23
23
  "@christianriedl/epg": "^1.0.43"
24
24
  },
25
25
  "devDependencies": {
@@ -3,14 +3,13 @@
3
3
  import type { ComponentPublicInstance } from 'vue';
4
4
  import { useRouter, useRoute } from 'vue-router';
5
5
  import { IAppState, Helper, EDevice, EScope, appStateSymbol, IAppConfig, appConfigSymbol } from '@christianriedl/utils';
6
- import { Authorize, authorizeSymbol } from '@christianriedl/rest';
7
6
  import { EItemType, EMediaType, IMediaFolder, IMediaItem, IAudioFile, IMediaService, EPlayState, PlayerService,
8
7
  IMediaAppConfig, getMediaBinSymbol, getPlayerSymbol } from '@christianriedl/media';
9
8
  import FileUpload from '../components/FileUpload.vue';
10
9
 
11
10
  const appState = inject(appStateSymbol)!;
12
- const authorize = inject(authorizeSymbol)!;
13
- const mediaAppConfig = inject(appConfigSymbol)! as unknown as IMediaAppConfig;
11
+ const appConfig = inject(appConfigSymbol)!;
12
+ const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
14
13
  const getMediaService = inject(getMediaBinSymbol)!;
15
14
  const mediaService = getMediaService() ;
16
15
  const getPlayerService = inject(getPlayerSymbol)!;
@@ -21,7 +20,7 @@
21
20
 
22
21
  const router = useRouter();
23
22
  const route = useRoute();
24
- const supportsLocalMedia = ref(authorize.checkScope(EScope.Media));
23
+ const supportsLocalMedia = ref(appConfig.isLocal);
25
24
  const playerNames = reactive<string[]>(['Local']);
26
25
  const currentPlayer = ref('Local');
27
26
  const items: IMediaItem[] = reactive([]);
@@ -348,6 +348,16 @@
348
348
  else {
349
349
  item.blob = getUrl(item);
350
350
  }
351
+ if (playerService.currentPlayer) {
352
+ const request = {
353
+ playerName: playerService.currentPlayer.playerName,
354
+ folderId: item.dlnaParentId,
355
+ mediaId: item.dlnaid,
356
+ trackNo: -1,
357
+ withStreamTitle: false
358
+ };
359
+ const rc = playerService!.play(request).then(() => { });
360
+ }
351
361
  nameTimer = window.setTimeout(() => { onLoad(item); }, 200);
352
362
  }
353
363
  function onLoad(item: IPictureFile) { // img loaded or cached
@@ -368,16 +378,6 @@
368
378
  itemName.value = item.title;
369
379
  nameTimer = window.setTimeout(() => { clearName(); }, mediaAppConfig.nameDurationMS);
370
380
  }
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
- }
381
381
  }
382
382
  function createBlob(item: IPictureFile) {
383
383
  item.blob = appConfig.urlPrefix + "img/Wait.png";
@@ -3,7 +3,7 @@
3
3
  import type { ComponentPublicInstance } from 'vue';
4
4
  import { useRouter, useRoute } from 'vue-router';
5
5
  import { IAppState, IAppConfig, EDevice, EBrowser, appStateSymbol, appConfigSymbol, Helper, EScope } from '@christianriedl/utils';
6
- import { IRestResult, IValueResult, authorizeSymbol } from '@christianriedl/rest';
6
+ import { IRestResult, IValueResult } from '@christianriedl/rest';
7
7
  import { EItemType, EMediaType, IMediaFolder, IMediaItem, IPhotoSelection, IMediaService, getMediaBinSymbol,
8
8
  IPlayerConfiguration, getPlayerSymbol, IMediaAppConfig, MediaHelper, LocationHelper
9
9
  } from '@christianriedl/media';
@@ -12,13 +12,12 @@
12
12
 
13
13
  const appState = inject(appStateSymbol)!;
14
14
  const appConfig = inject(appConfigSymbol)!;
15
- const authorize = inject(authorizeSymbol)!;
16
15
  const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
17
16
  const getMediaService = inject(getMediaBinSymbol)!;
18
17
  const mediaService = getMediaService();
19
18
  const getPlayerService = inject(getPlayerSymbol)!;
20
19
  const playerService = getPlayerService();
21
- const supportsLocalMedia = authorize.checkScope(EScope.Media);
20
+ const supportsLocalMedia = appConfig.isLocal;
22
21
 
23
22
  //const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
24
23
  const isMobile = appState.isMobile && (appState.device != EDevice.iPad);
@@ -57,13 +56,7 @@
57
56
  async function start() {
58
57
  let root: IMediaFolder;
59
58
  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
- }
59
+ playerService.getPlayersOnline(false);
67
60
  }
68
61
  if (route.query && route.query.id) {
69
62
  const id = decodeURIComponent(route.query.id.toString());
@@ -188,8 +181,10 @@
188
181
  async function onSearch() {
189
182
  router.push({ path: 'photothumbnails' });
190
183
  }
191
- function playTV(config: IPlayerConfiguration) {
192
- playerService.currentPlayer = config;
184
+ async function playTV(config: IPlayerConfiguration) {
185
+ const playerState = await playerService.getPlayerState(config.playerName);
186
+ if (config.online)
187
+ playerService.currentPlayer = config;
193
188
  }
194
189
  async function initialize(selectedName?: string) {
195
190
  let root = await mediaService.getPhotosByCriteria(stars(), selected.criteria);
@@ -3,20 +3,19 @@
3
3
  import type { ComponentPublicInstance } from 'vue';
4
4
  import { useRouter, useRoute } from 'vue-router';
5
5
  import { IAppState, EDevice, EScope, appStateSymbol, appConfigSymbol, IValueText } from '@christianriedl/utils';
6
- import { Authorize, authorizeSymbol } from '@christianriedl/rest';
7
6
  import { EItemType, EMediaType, IMediaFolder, IMediaItem, IVideoFile, IMediaService, MediaHelper,
8
7
  getMediaBinSymbol, getPlayerSymbol, IMediaAppConfig, ITranscodeParams, IPlayerConfiguration
9
8
  } from '@christianriedl/media';
10
9
  import FileUpload from '../components/FileUpload.vue';
11
10
 
12
11
  const appState = inject(appStateSymbol)!;
13
- const authorize = inject(authorizeSymbol)!;
14
- const mediaAppConfig = inject(appConfigSymbol)! as unknown as IMediaAppConfig;
12
+ const appConfig = inject(appConfigSymbol)!;
13
+ const mediaAppConfig = appConfig as unknown as IMediaAppConfig;
15
14
  const getMediaService = inject(getMediaBinSymbol)!;
16
15
  const mediaService = getMediaService() ;
17
16
  const getPlayerService = inject(getPlayerSymbol)!;
18
17
  const playerService = getPlayerService();
19
- const supportsLocalMedia = authorize.checkScope(EScope.Media);
18
+ const supportsLocalMedia = appConfig.isLocal;
20
19
 
21
20
  const heightStyle = computed<StyleValue>(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
22
21
  const isMobile = appState.isMobile && (appState.device != EDevice.iPad);
@@ -102,15 +101,17 @@
102
101
  router.push({ path: 'video', query: { url: url, media: parSet ? selected.value.url : "" } });
103
102
  }
104
103
  async function playTV(config: IPlayerConfiguration) {
105
- playerService.currentPlayer = config;
106
- const request = {
107
- playerName: config.playerName,
108
- folderId: selected.value.dlnaParentId,
109
- mediaId: selected.value.dlnaid,
110
- trackNo: 0,
111
- withStreamTitle: false
112
- };
113
- const rc = await playerService!.play(request);
104
+ const playerState = await playerService.getPlayerState(config.playerName);
105
+ if (config.online) {
106
+ const request = {
107
+ playerName: config.playerName,
108
+ folderId: selected.value.dlnaParentId,
109
+ mediaId: selected.value.dlnaid,
110
+ trackNo: 0,
111
+ withStreamTitle: false
112
+ };
113
+ const rc = await playerService!.play(request);
114
+ }
114
115
  }
115
116
  function recorded() {
116
117
  router.push({ path: 'recordedvideos' });
@@ -186,13 +187,7 @@
186
187
  }
187
188
  async function getPlayer() {
188
189
  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
- }
190
+ playerService.getPlayersOnline(false);
196
191
  }
197
192
  }
198
193
  async function onShare(item: IMediaItem) {