mirror of
https://github.com/remvze/moodist.git
synced 2025-12-17 00:44:14 +00:00
feat: add media session (wip)
This commit is contained in:
parent
11a4514a0f
commit
f79e941527
1 changed files with 5 additions and 0 deletions
|
|
@ -8,11 +8,16 @@ export function useMediaSession() {
|
|||
useEffect(() => {
|
||||
if ('mediaSession' in navigator) {
|
||||
if (isPlaying) {
|
||||
console.log('hello');
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
title: 'Moodist - Ambient Sounds',
|
||||
});
|
||||
|
||||
navigator.mediaSession.setActionHandler('play', function () {});
|
||||
navigator.mediaSession.setActionHandler('pause', function () {});
|
||||
} else {
|
||||
navigator.mediaSession.metadata = null;
|
||||
console.log('bye');
|
||||
}
|
||||
}
|
||||
}, [isPlaying]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue