Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Add effect to set media session metadata (#3713)

mahmed20009160139dfabb
diff --git a/web/components/TitleNotifier/TitleNotifier.tsx b/web/components/TitleNotifier/TitleNotifier.tsx
index a6f3dce62b..e69c7fad03 100644
--- a/web/components/TitleNotifier/TitleNotifier.tsx
+++ b/web/components/TitleNotifier/TitleNotifier.tsx
@@ -21,7 +21,7 @@ export const TitleNotifier: FC<TitleNotifierProps> = ({ name }) => {
const [backgrounded, setBackgrounded] = useState(false);
const [title, setTitle] = useState(name);
- const { online } = serverStatus;
+ const { online, streamTitle } = serverStatus;
const onBlur = () => {
setBackgrounded(true);
@@ -66,6 +66,17 @@ export const TitleNotifier: FC<TitleNotifierProps> = ({ name }) => {
setTitle(`💬 :: ${name}`);
}, [chatMessages, name]);
+ useEffect(() => {
+ if (navigator.mediaSession === undefined) {
+ return;
+ }
+ navigator.mediaSession.metadata = new MediaMetadata({
+ title: streamTitle,
+ artist: name,
+ artwork: [{ src: '/logo' }],
+ });
+ }, [name, streamTitle]);
+
useEffect(() => {
if (!backgrounded) {
return;