@christianriedl/media 1.0.277 → 1.0.279
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/dist/playerService.d.ts +4 -4
- package/dist/playerService.js +22 -10
- package/dist/playerService.js.map +1 -1
- package/package.json +2 -2
- package/src/views/MusicPage.vue +3 -4
- package/src/views/PhotoAlbumPage.vue +3 -3
- package/src/views/PhotosGridPage.vue +3 -10
- package/src/views/VideosPage.vue +4 -11
package/dist/playerService.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRest } from '@christianriedl/rest';
|
|
2
|
-
import { ILogger, InjectionKey
|
|
2
|
+
import { ILogger, InjectionKey } from '@christianriedl/utils';
|
|
3
3
|
import { EMediaType } from "./iMedia";
|
|
4
4
|
export declare enum EPlayState {
|
|
5
5
|
PowerOff = 0,
|
|
@@ -36,8 +36,8 @@ export interface IPlayerConfiguration {
|
|
|
36
36
|
playerName: string;
|
|
37
37
|
shortName: string;
|
|
38
38
|
sensorName: string;
|
|
39
|
-
online:
|
|
40
|
-
playerState:
|
|
39
|
+
online: boolean;
|
|
40
|
+
playerState: IPlayerState | null;
|
|
41
41
|
}
|
|
42
42
|
export declare const getPlayerSymbol: InjectionKey<() => PlayerService>;
|
|
43
43
|
export declare class PlayerService {
|
|
@@ -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
|
}
|
package/dist/playerService.js
CHANGED
|
@@ -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";
|
|
@@ -34,7 +35,7 @@ export class PlayerService {
|
|
|
34
35
|
this.playerNames = players.result;
|
|
35
36
|
for (let i = 0; i < this.playerConfigurations.length; i++) {
|
|
36
37
|
const config = this.playerConfigurations[i];
|
|
37
|
-
config.online
|
|
38
|
+
config.online = this.playerNames.includes(config.playerName);
|
|
38
39
|
}
|
|
39
40
|
return this.playerNames;
|
|
40
41
|
}
|
|
@@ -43,12 +44,19 @@ 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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (config) {
|
|
57
|
+
config.online = false;
|
|
58
|
+
config.playerState = null;
|
|
49
59
|
}
|
|
50
|
-
config.online.value = false;
|
|
51
|
-
config.playerState.value = null;
|
|
52
60
|
return null;
|
|
53
61
|
}
|
|
54
62
|
async play(playerRequest) {
|
|
@@ -75,16 +83,20 @@ export class PlayerService {
|
|
|
75
83
|
const result = await this.rest.postData('apiplayer/playcommand', playerCommand);
|
|
76
84
|
return result.ok;
|
|
77
85
|
}
|
|
78
|
-
getPlayersOnline() {
|
|
86
|
+
getPlayersOnline(checkState) {
|
|
79
87
|
let count = 0;
|
|
80
88
|
for (let i = 0; i < this.playerConfigurations.length; i++) {
|
|
81
89
|
const config = this.playerConfigurations[i];
|
|
82
90
|
if (config.sensorName && this.getSensorOnline)
|
|
83
|
-
config.online
|
|
91
|
+
config.online = this.getSensorOnline(config.sensorName);
|
|
84
92
|
else
|
|
85
|
-
config.online
|
|
86
|
-
if (config.online
|
|
93
|
+
config.online = false;
|
|
94
|
+
if (config.online)
|
|
87
95
|
count++;
|
|
96
|
+
if (checkState) {
|
|
97
|
+
config.playerState = null;
|
|
98
|
+
this.getPlayerState(config.playerName).then(playerState => { }).catch(err => { });
|
|
99
|
+
}
|
|
88
100
|
}
|
|
89
101
|
return count;
|
|
90
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerService.js","sourceRoot":"","sources":["../src/playerService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playerService.js","sourceRoot":"","sources":["../src/playerService.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,MAAM,EAA4B,MAAM,uBAAuB,CAAC;AAMlF,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IAClB,mDAAY,CAAA;IACZ,iDAAO,CAAA;IACP,+CAAM,CAAA;IACN,iDAAO,CAAA;IACP,2CAAI,CAAA;IACJ,iDAAO,CAAA;IACP,mDAAQ,CAAA;AACZ,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB;AAkCD,MAAM,CAAC,MAAM,eAAe,GAAsC,MAAM,CAAC,YAAY,CAAC,CAAC;AAEvF,MAAM,OAAO,aAAa;IACtB,IAAI,CAAQ;IACZ,QAAQ,CAAS;IACjB,GAAG,CAAU;IACb,WAAW,GAAa,EAAE,CAAC;IAC3B,oBAAoB,CAAyB;IAC7C,aAAa,CAAwB;IACrC,eAAe,CAAwC;IACvD,YAAY,IAAW,EAAE,GAAY,EAAE,OAA+B,EAAE,eAAsD;QAC1H,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;QAChC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACpC,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,SAAsB,EAAE,OAAi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C;IACD,KAAK,CAAC,OAAO,CAAC,aAA6B;QACvC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAM,uBAAuB,EAAE,aAAa,CAAC,CAAC;QACrF,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.
|
|
3
|
+
"version": "1.0.279",
|
|
4
4
|
"description": "RIC media interfaces",
|
|
5
5
|
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@christianriedl/utils": "^1.0.167",
|
|
22
|
-
"@christianriedl/rest": "^1.0.
|
|
22
|
+
"@christianriedl/rest": "^1.0.89",
|
|
23
23
|
"@christianriedl/epg": "^1.0.43"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
package/src/views/MusicPage.vue
CHANGED
|
@@ -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
|
|
13
|
-
const mediaAppConfig =
|
|
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(
|
|
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([]);
|
|
@@ -368,15 +368,15 @@
|
|
|
368
368
|
itemName.value = item.title;
|
|
369
369
|
nameTimer = window.setTimeout(() => { clearName(); }, mediaAppConfig.nameDurationMS);
|
|
370
370
|
}
|
|
371
|
-
if (playerService.
|
|
371
|
+
if (playerService.currentPlayer) {
|
|
372
372
|
const request = {
|
|
373
|
-
playerName: playerService.
|
|
373
|
+
playerName: playerService.currentPlayer.playerName,
|
|
374
374
|
folderId: item.dlnaParentId,
|
|
375
375
|
mediaId: item.dlnaid,
|
|
376
376
|
trackNo: -1,
|
|
377
377
|
withStreamTitle: false
|
|
378
378
|
};
|
|
379
|
-
const rc = playerService!.play(request).then(() => );
|
|
379
|
+
const rc = playerService!.play(request).then(() => {});
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
function createBlob(item: IPictureFile) {
|
|
@@ -2,7 +2,7 @@
|
|
|
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,
|
|
5
|
+
import { IAppState, IAppConfig, EDevice, EBrowser, appStateSymbol, appConfigSymbol, Helper, EScope } from '@christianriedl/utils';
|
|
6
6
|
import { IRestResult, IValueResult } from '@christianriedl/rest';
|
|
7
7
|
import { EItemType, EMediaType, IMediaFolder, IMediaItem, IPhotoSelection, IMediaService, getMediaBinSymbol,
|
|
8
8
|
IPlayerConfiguration, getPlayerSymbol, IMediaAppConfig, MediaHelper, LocationHelper
|
|
@@ -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 =
|
|
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.length;
|
|
63
|
-
if (!config.playerState) {
|
|
64
|
-
playerService.getPlayerState(config.playerName);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
59
|
+
playerService.getPlayersOnline(true);
|
|
67
60
|
}
|
|
68
61
|
if (route.query && route.query.id) {
|
|
69
62
|
const id = decodeURIComponent(route.query.id.toString());
|
package/src/views/VideosPage.vue
CHANGED
|
@@ -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
|
|
14
|
-
const mediaAppConfig =
|
|
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 =
|
|
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);
|
|
@@ -186,13 +185,7 @@
|
|
|
186
185
|
}
|
|
187
186
|
async function getPlayer() {
|
|
188
187
|
if (supportsLocalMedia) {
|
|
189
|
-
playerService.getPlayersOnline();
|
|
190
|
-
for (let i = 0; i < playerService.playerConfigurations.length; i++) {
|
|
191
|
-
const config = playerService.playerConfigurations.length;
|
|
192
|
-
if (!config.playerState) {
|
|
193
|
-
await playerService.getPlayerState(config.playerName);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
188
|
+
playerService.getPlayersOnline(true);
|
|
196
189
|
}
|
|
197
190
|
}
|
|
198
191
|
async function onShare(item: IMediaItem) {
|