From f1e33abeb08bffe858287c5b4b771caf165d52f6 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 24 Jul 2026 16:16:51 +0200 Subject: [PATCH] Fix notification on videojs side --- .../@videojs%2Fcore@10.0.0-beta.25.patch | 41 ++++++++++++++++++- front/src/ui/player/index.tsx | 18 +++++++- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/front/patches/@videojs%2Fcore@10.0.0-beta.25.patch b/front/patches/@videojs%2Fcore@10.0.0-beta.25.patch index f348b5f05..ce4a5b9c0 100644 --- a/front/patches/@videojs%2Fcore@10.0.0-beta.25.patch +++ b/front/patches/@videojs%2Fcore@10.0.0-beta.25.patch @@ -1,9 +1,29 @@ +diff --git a/node_modules/@videojs/core/.bun-tag-2ae87bfdc8c60c18 b/.bun-tag-2ae87bfdc8c60c18 +new file mode 100644 +index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/node_modules/@videojs/core/.bun-tag-6ae2888ce9205340 b/.bun-tag-6ae2888ce9205340 new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/node_modules/@videojs/core/.bun-tag-c99bf98327cf098c b/.bun-tag-c99bf98327cf098c new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 +diff --git a/dist/default/dom/media/google-cast/google-cast-provider.js b/dist/default/dom/media/google-cast/google-cast-provider.js +index 1ab903161eed3118320a71fb2a4be8c606be87de..21cbafc728be9d02cc9890eccf1821874df47108 100644 +--- a/dist/default/dom/media/google-cast/google-cast-provider.js ++++ b/dist/default/dom/media/google-cast/google-cast-provider.js +@@ -110,7 +110,11 @@ var GoogleCastProvider = class { + }); + mediaInfo.streamType = this.#googleCast.streamType === "live" ? chrome.cast.media.StreamType.LIVE : chrome.cast.media.StreamType.BUFFERED; + mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata(); +- mediaInfo.metadata.images = [new chrome.cast.Image(target?.poster ?? "")]; ++ const castMeta = mediaInfo.customData ?? {}; ++ if (castMeta.title) mediaInfo.metadata.title = castMeta.title; ++ if (castMeta.subtitle) mediaInfo.metadata.subtitle = castMeta.subtitle; ++ const castImage = castMeta.poster ?? target?.poster; ++ if (castImage) mediaInfo.metadata.images = [new chrome.cast.Image(castImage)]; + if (await isHls(this.#googleCast.src)) { + mediaInfo.contentType ||= "application/x-mpegURL"; + const fmt = await getPlaylistSegmentFormat(this.#googleCast.src) ?? ""; diff --git a/dist/default/dom/media/google-cast/utils.js b/dist/default/dom/media/google-cast/utils.js index 8ca144e0a61f3f25b7628964a2dff818efc689f3..ef2660883dc0be47e18009773d0922a95ac274dd 100644 --- a/dist/default/dom/media/google-cast/utils.js @@ -97,7 +117,7 @@ index 99ca6c647292de8ee811f6b0595b23744301fa88..fadfd434b71d2053e6565857a9a8db6a engine?.off(Hls.Events.LEVEL_SWITCHED, this.#onLevelSwitched); engine?.off(Hls.Events.DESTROYING, this.#teardown); diff --git a/dist/default/dom/store/features/remote-playback.js b/dist/default/dom/store/features/remote-playback.js -index 9a00dbf2858199afe8a66c8f3796ba78efdfc7bc..d59fc75ad19a88acd94d66b196b78ad9a48d73d1 100644 +index 9a00dbf2858199afe8a66c8f3796ba78efdfc7bc..16737d05303a2806575ba6ea0984d84bb8266af7 100644 --- a/dist/default/dom/store/features/remote-playback.js +++ b/dist/default/dom/store/features/remote-playback.js @@ -1,7 +1,9 @@ @@ -166,6 +186,23 @@ index 9a00dbf2858199afe8a66c8f3796ba78efdfc7bc..d59fc75ad19a88acd94d66b196b78ad9 const syncState = () => set({ remotePlaybackState: media.remote.state }); syncState(); listen(media.remote, "connect", syncState, { signal }); +diff --git a/dist/dev/dom/media/google-cast/google-cast-provider.js b/dist/dev/dom/media/google-cast/google-cast-provider.js +index 1ab903161eed3118320a71fb2a4be8c606be87de..21cbafc728be9d02cc9890eccf1821874df47108 100644 +--- a/dist/dev/dom/media/google-cast/google-cast-provider.js ++++ b/dist/dev/dom/media/google-cast/google-cast-provider.js +@@ -110,7 +110,11 @@ var GoogleCastProvider = class { + }); + mediaInfo.streamType = this.#googleCast.streamType === "live" ? chrome.cast.media.StreamType.LIVE : chrome.cast.media.StreamType.BUFFERED; + mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata(); +- mediaInfo.metadata.images = [new chrome.cast.Image(target?.poster ?? "")]; ++ const castMeta = mediaInfo.customData ?? {}; ++ if (castMeta.title) mediaInfo.metadata.title = castMeta.title; ++ if (castMeta.subtitle) mediaInfo.metadata.subtitle = castMeta.subtitle; ++ const castImage = castMeta.poster ?? target?.poster; ++ if (castImage) mediaInfo.metadata.images = [new chrome.cast.Image(castImage)]; + if (await isHls(this.#googleCast.src)) { + mediaInfo.contentType ||= "application/x-mpegURL"; + const fmt = await getPlaylistSegmentFormat(this.#googleCast.src) ?? ""; diff --git a/dist/dev/dom/media/google-cast/utils.js b/dist/dev/dom/media/google-cast/utils.js index 8ca144e0a61f3f25b7628964a2dff818efc689f3..ef2660883dc0be47e18009773d0922a95ac274dd 100644 --- a/dist/dev/dom/media/google-cast/utils.js @@ -259,7 +296,7 @@ index 99ca6c647292de8ee811f6b0595b23744301fa88..fadfd434b71d2053e6565857a9a8db6a engine?.off(Hls.Events.LEVEL_SWITCHED, this.#onLevelSwitched); engine?.off(Hls.Events.DESTROYING, this.#teardown); diff --git a/dist/dev/dom/store/features/remote-playback.js b/dist/dev/dom/store/features/remote-playback.js -index 9a00dbf2858199afe8a66c8f3796ba78efdfc7bc..d59fc75ad19a88acd94d66b196b78ad9a48d73d1 100644 +index 9a00dbf2858199afe8a66c8f3796ba78efdfc7bc..16737d05303a2806575ba6ea0984d84bb8266af7 100644 --- a/dist/dev/dom/store/features/remote-playback.js +++ b/dist/dev/dom/store/features/remote-playback.js @@ -1,7 +1,9 @@ diff --git a/front/src/ui/player/index.tsx b/front/src/ui/player/index.tsx index e92cbc3aa..2a7f4b376 100644 --- a/front/src/ui/player/index.tsx +++ b/front/src/ui/player/index.tsx @@ -94,7 +94,23 @@ export const Player = () => { hasNext: !!data?.next?.video, }, castId: `${apiUrl}/api/videos/${slug}`, - castData: { apiUrl, slug, clientId, ...(authToken && { token: authToken }) }, + castData: { + apiUrl, + slug, + clientId, + ...(authToken && { token: authToken }), + // Cast notification metadata for the sender: videojs otherwise loads + // an empty GenericMediaMetadata, so the phone/lock-screen notification + // falls back to the app/device name. The image must be an absolute, + // authed URL to load off-device (thumbnail.high is relative). + title: title ?? data?.path ?? "", + ...(data?.show?.name && { subtitle: data.show.name }), + ...(data?.show?.thumbnail?.id && { + poster: `${apiUrl}/api/images/${data.show.thumbnail.id}?quality=high${ + authToken ? `&session-token=${authToken}` : "" + }`, + }), + }, }), [apiUrl, slug, playMode, info, authToken, start, data, title], );