mirror of
https://github.com/remvze/moodist.git
synced 2025-12-18 01:14:17 +00:00
refactor: remove unmute and media session
This commit is contained in:
parent
216b913ccd
commit
b77c817db2
3 changed files with 0 additions and 51 deletions
20
package-lock.json
generated
20
package-lock.json
generated
|
|
@ -21,7 +21,6 @@
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-icons": "4.11.0",
|
"react-icons": "4.11.0",
|
||||||
"react-wrap-balancer": "1.1.0",
|
"react-wrap-balancer": "1.1.0",
|
||||||
"unmute-ios-audio": "3.3.0",
|
|
||||||
"zustand": "4.4.3"
|
"zustand": "4.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
@ -15786,25 +15785,6 @@
|
||||||
"node": ">= 10.0.0"
|
"node": ">= 10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/unmute-ios-audio": {
|
|
||||||
"version": "3.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/unmute-ios-audio/-/unmute-ios-audio-3.3.0.tgz",
|
|
||||||
"integrity": "sha512-MmoCOrsS2gn3wLT2tT+hF56Q4V4kksIKn2LHrwAtX6umzQwQHDWSh1slMzH+0WuxTZ62s3w8/wsfIII1FQ7ACg==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/feross"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "consulting",
|
|
||||||
"url": "https://feross.org/support"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/untildify": {
|
"node_modules/untildify": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-icons": "4.11.0",
|
"react-icons": "4.11.0",
|
||||||
"react-wrap-balancer": "1.1.0",
|
"react-wrap-balancer": "1.1.0",
|
||||||
"unmute-ios-audio": "3.3.0",
|
|
||||||
"zustand": "4.4.3"
|
"zustand": "4.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import { useMemo, useEffect } from 'react';
|
||||||
import { useShallow } from 'zustand/react/shallow';
|
import { useShallow } from 'zustand/react/shallow';
|
||||||
import { BiSolidHeart } from 'react-icons/bi/index';
|
import { BiSolidHeart } from 'react-icons/bi/index';
|
||||||
import { Howler } from 'howler';
|
import { Howler } from 'howler';
|
||||||
import unmuteAudio from 'unmute-ios-audio';
|
|
||||||
|
|
||||||
import { useSoundStore } from '@/store';
|
import { useSoundStore } from '@/store';
|
||||||
|
|
||||||
|
|
@ -23,9 +22,6 @@ export function App() {
|
||||||
const categories = useMemo(() => sounds.categories, []);
|
const categories = useMemo(() => sounds.categories, []);
|
||||||
|
|
||||||
const favorites = useSoundStore(useShallow(state => state.getFavorites()));
|
const favorites = useSoundStore(useShallow(state => state.getFavorites()));
|
||||||
const play = useSoundStore(state => state.play);
|
|
||||||
const pause = useSoundStore(state => state.pause);
|
|
||||||
const isPlaying = useSoundStore(state => state.isPlaying);
|
|
||||||
|
|
||||||
const favoriteSounds = useMemo(() => {
|
const favoriteSounds = useMemo(() => {
|
||||||
const favoriteSounds = categories
|
const favoriteSounds = categories
|
||||||
|
|
@ -57,32 +53,6 @@ export function App() {
|
||||||
return () => document.removeEventListener('visibilitychange', onChange);
|
return () => document.removeEventListener('visibilitychange', onChange);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
unmuteAudio();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
try {
|
|
||||||
navigator.mediaSession.setActionHandler('play', play);
|
|
||||||
navigator.mediaSession.setActionHandler('pause', pause);
|
|
||||||
navigator.mediaSession.setActionHandler('stop', pause);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('Media session is no supported yet');
|
|
||||||
}
|
|
||||||
}, [play, pause]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (isPlaying) {
|
|
||||||
navigator.mediaSession.metadata = new MediaMetadata({
|
|
||||||
title: 'Moodist',
|
|
||||||
});
|
|
||||||
|
|
||||||
navigator.mediaSession.playbackState = 'playing';
|
|
||||||
} else {
|
|
||||||
navigator.mediaSession.playbackState = 'paused';
|
|
||||||
}
|
|
||||||
}, [isPlaying]);
|
|
||||||
|
|
||||||
const allCategories = useMemo(() => {
|
const allCategories = useMemo(() => {
|
||||||
const favorites = [];
|
const favorites = [];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue