Skip to content

A self-hosted media server and file management system

fix: media session artwork https issue

aminnausin406c42761c83
diff --git a/resources/js/components/video/VideoPlayer.vue b/resources/js/components/video/VideoPlayer.vue
index 78096f2c..eb61f790 100755
--- a/resources/js/components/video/VideoPlayer.vue
+++ b/resources/js/components/video/VideoPlayer.vue
@@ -273,11 +273,12 @@ const initVideoPlayer = async () => {
metadataId.value = stateVideo.value?.metadata ? stateVideo.value?.metadata.id : NaN;
if (isMediaSession.value && !isNaN(metadataId.value)) {
- const artworkURL = stateVideo.value.metadata?.poster_url?.length
- ? stateVideo.value.metadata?.poster_url
- : stateFolder.value.series?.thumbnail_url?.length
- ? stateFolder.value.series?.thumbnail_url
- : new URL('/storage/thumbnails/default.webp', window.location.origin).href;
+ const artworkURL =
+ stateVideo.value.metadata?.poster_url ||
+ stateFolder.value.series?.thumbnail_url ||
+ handleStorageURL(new URL('/storage/thumbnails/default.webp', window.location.origin).href);
+
+ console.log(artworkURL);
const newMediaSession = new MediaMetadata({
title: stateVideo.value.metadata?.title,
diff --git a/resources/js/service/util.ts b/resources/js/service/util.ts
index b01217f0..2388752b 100644
--- a/resources/js/service/util.ts
+++ b/resources/js/service/util.ts
@@ -197,8 +197,8 @@ export function within24Hrs(date: string): boolean {
* @param url The storage URL string.
* @returns The storage URL string with the correct protocol.
*/
-export function handleStorageURL(url: string | undefined): string | null {
- if (!url) return null;
+export function handleStorageURL(url: string | undefined): string {
+ if (!url) return '';
if (window.location.protocol === 'http:' && url.startsWith(`https://${window.location.host}`)) return url.replace('https:', 'http:');