Don't pump the volume up to 100% if it is not in a mobile device. Fix #2255

This detection method is not bullet-proof, but should work for now.

Ref: https://stackoverflow.com/a/3540295
This commit is contained in:
Deluan 2023-03-16 17:25:07 -04:00
parent 377e7ebd52
commit 7ea111322b
1 changed files with 5 additions and 3 deletions

View File

@ -46,9 +46,11 @@ const Player = () => {
const [preloaded, setPreload] = useState(false)
const [audioInstance, setAudioInstance] = useState(null)
const isDesktop = useMediaQuery('(min-width:810px)')
const isMobilePlayer = useMediaQuery(
'(max-width: 768px) and (orientation : portrait)'
)
const isMobilePlayer =
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
const { authenticated } = useAuthState()
const visible = authenticated && playerState.queue.length > 0
const isRadio = playerState.current?.isRadio || false