@christianriedl/media 1.0.6 → 1.0.7
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
package/src/views/MusicPage.vue
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
|
|
3
3
|
import { IAppState, Helper } from '@christianriedl/utils';
|
|
4
|
+
import { Authorize } from '@christianriedl/rest';
|
|
4
5
|
import { EItemType, EMediaType, IMediaFolder, IMediaItem, IAudioFile, MediaService, EPlayState, PlayerService } from '@christianriedl/media';
|
|
5
6
|
|
|
6
7
|
const appState = inject<IAppState>('appstate')!;
|
|
8
|
+
const authorize = inject<Authorize>('authorize')!;
|
|
7
9
|
const getMediaService = inject<() => MediaService>('get-media')!;
|
|
8
10
|
const mediaService = getMediaService();
|
|
9
11
|
const getPlayerService = inject<() => PlayerService>('get-player')!;
|
|
10
12
|
const playerService = getPlayerService();
|
|
11
13
|
const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
|
|
12
14
|
const isMobile = appState.isMobile;
|
|
15
|
+
const supportsLocalMedia = authorize.checkScope(['Media']);
|
|
13
16
|
|
|
14
17
|
const playerNames = reactive<string[]>(['Local']);
|
|
15
18
|
const currentPlayer = ref('Local');
|
|
@@ -70,8 +73,10 @@
|
|
|
70
73
|
selected.value = root;
|
|
71
74
|
items.splice(0, items.length, ...root.Folders);
|
|
72
75
|
computeListHeight();
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
if (supportsLocalMedia) {
|
|
77
|
+
const players = await playerService.getPlayers(EMediaType.Audio, true);
|
|
78
|
+
playerNames.splice(playerNames.length, 0, ...players);
|
|
79
|
+
}
|
|
75
80
|
})
|
|
76
81
|
watch(appState.bodyHeight, () => computeListHeight());
|
|
77
82
|
function computeListHeight() {
|
|
@@ -302,7 +307,7 @@
|
|
|
302
307
|
<v-list-item-subtitle v-if="playingTrack">{{playingTrack.Name}}</v-list-item-subtitle>
|
|
303
308
|
</v-list-item-content>
|
|
304
309
|
</v-col>
|
|
305
|
-
<v-col cols="4">
|
|
310
|
+
<v-col cols="4" v-if="supportsLocalMedia">
|
|
306
311
|
<v-select v-model="currentPlayer"
|
|
307
312
|
:items="playerNames"
|
|
308
313
|
persistent-hint
|
|
@@ -336,7 +341,7 @@
|
|
|
336
341
|
<v-btn small v-if="downloadVisible" @click="download">
|
|
337
342
|
<v-icon>{{$vuetify.icons.values.download}}</v-icon>
|
|
338
343
|
</v-btn>
|
|
339
|
-
<v-slider v-if="playingTrack" style="width:30%" color="red" track-color="blue" track-fill-color="red" v-model="volume" hide-details density="compact"
|
|
344
|
+
<v-slider v-if="!isLocal && playingTrack" style="width:30%" color="red" track-color="blue" track-fill-color="red" v-model="volume" hide-details density="compact"
|
|
340
345
|
min="0" max="100" step="5" @update:modelValue="changeVolume">
|
|
341
346
|
</v-slider>
|
|
342
347
|
</v-card-actions>
|
package/src/views/VideosPage.vue
CHANGED
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
|
|
3
3
|
import { useRouter } from 'vue-router';
|
|
4
4
|
import { IAppState } from '@christianriedl/utils';
|
|
5
|
+
import { Authorize } from '@christianriedl/rest';
|
|
5
6
|
import { EItemType, EMediaType, IMediaFolder, IMediaItem, IVideoFile, MediaService, PlayerService } from '@christianriedl/media';
|
|
6
7
|
import { ISensorsState } from '@christianriedl/smarthome';
|
|
7
8
|
|
|
8
9
|
const appState = inject<IAppState>('appstate')!;
|
|
9
10
|
const sensors = inject<ISensorsState>('smarthome')!;
|
|
11
|
+
const authorize = inject<Authorize>('authorize')!;
|
|
10
12
|
const getMediaService = inject<() => MediaService>('get-media')!;
|
|
11
13
|
const mediaService = getMediaService();
|
|
12
14
|
const getPlayerService = inject<() => PlayerService>('get-player')!;
|
|
13
15
|
const playerService = getPlayerService();
|
|
14
16
|
const rendererName = "[TV] Samsung Q9 Series (75)";
|
|
15
17
|
const showRenderer = ref(false);
|
|
18
|
+
const supportsLocalMedia = authorize.checkScope(['Media']);
|
|
16
19
|
|
|
17
20
|
const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
|
|
18
21
|
const isMobile = appState.isMobile;
|
|
@@ -30,7 +33,9 @@
|
|
|
30
33
|
const playVisible = computed(() => selected.value.ItemType == EItemType.VideoItem);
|
|
31
34
|
const dialogWidth = computed(() => isMobile ? appState.pageWidth : 600);
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
if (supportsLocalMedia) {
|
|
37
|
+
getPlayer();
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
window.addEventListener('popstate', onPopState);
|
|
36
41
|
function onPopState(event: any) {
|