mirror of
https://github.com/owncast/owncast.git
synced 2024-11-21 12:18:02 +03:00
Add effect to set media session metadata (#3713)
This commit is contained in:
parent
8dd43ea6cc
commit
56eef2e601
1 changed files with 12 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue