11"use client" ;
22
3- import { Box , Text , ActionIcon , Group , Slider , Tooltip , Button , Flex } from '@mantine/core' ;
3+ import { Box , Text , ActionIcon , Group , Slider , Tooltip , Button , Flex , Alert } from '@mantine/core' ;
44import {
55 LuChevronDown , LuPlay , LuPause , LuSkipBack , LuSkipForward , LuListMusic , LuMic , LuMusic ,
66 LuHeadphones , LuVolume1 , LuVolume2
@@ -35,6 +35,7 @@ import {
3535import { useStandardPlayerWeb } from './StandardPlayer.web.hook' ;
3636import { formatTime } from '../../Footer.logic' ;
3737import { useRef } from 'react' ;
38+ import { isIOSMobile } from '@utils/platform' ;
3839
3940// NOTE: This component assumes it's only rendered on desktop.
4041
@@ -64,6 +65,7 @@ export const StandardPlayerWeb = (props: StandardPlayerProps) => {
6465 displayTitle,
6566 displayArtist,
6667 iconProps,
68+ layeredAudioMessage,
6769 } = useStandardPlayerWeb ( props ) ;
6870
6971 const {
@@ -96,6 +98,8 @@ export const StandardPlayerWeb = (props: StandardPlayerProps) => {
9698 pauseVoice,
9799 } = props ;
98100
101+ const isIOS = isIOSMobile ( ) ;
102+
99103 return (
100104 < Flex
101105 align = "center"
@@ -226,17 +230,16 @@ export const StandardPlayerWeb = (props: StandardPlayerProps) => {
226230 } }
227231 onMouseEnter = { ( ) => setIsNarrationHovered ( true ) }
228232 onMouseLeave = { ( ) => setIsNarrationHovered ( false ) }
233+ disabled = { isIOS }
229234 >
230235 Narration
231236 </ Button >
232- { isNarrationEnabled && (
233- < Tooltip label = "Narration Volume" position = "top" withArrow >
234- < Group gap = { 2 } wrap = "nowrap" align = "center" style = { { cursor : 'pointer' } } >
235- < ActionIcon size = "xs" variant = "transparent" color = { iconProps . color } style = { { pointerEvents : 'none' , opacity : 0.7 } } > < LuVolume1 size = { 12 } color = { colorScheme === 'dark' ? theme . white : 'currentColor' } /> </ ActionIcon >
236- < Slider value = { voiceVolume } onChange = { onVoiceVolumeChange } min = { 0 } max = { 1 } step = { 0.01 } size = { 2 } thumbSize = { 10 } style = { sliderStyle } color = { iconProps . color } aria-label = "Narration volume" styles = { { thumb : { transition : 'transform 0.1s ease' , ':hover' : { transform : 'scale(1.2)' } } , track : { transition : 'all 0.1s ease' } } } />
237- < ActionIcon size = "xs" variant = "transparent" color = { iconProps . color } style = { { pointerEvents : 'none' , opacity : 0.7 } } > < LuVolume2 size = { 14 } color = { colorScheme === 'dark' ? theme . white : 'currentColor' } /> </ ActionIcon >
238- </ Group >
237+ { isIOS ? (
238+ < Tooltip label = "Volume control is not available on iOS. Use your device volume buttons." position = "top" withArrow >
239+ < Slider value = { voiceVolume } onChange = { onVoiceVolumeChange } min = { 0 } max = { 1 } step = { 0.01 } size = { 2 } thumbSize = { 10 } style = { sliderStyle } color = { iconProps . color } aria-label = "Narration volume" styles = { { thumb : { transition : 'transform 0.1s ease' , ':hover' : { transform : 'scale(1.2)' } } , track : { transition : 'all 0.1s ease' } } } disabled />
239240 </ Tooltip >
241+ ) : (
242+ < Slider value = { voiceVolume } onChange = { onVoiceVolumeChange } min = { 0 } max = { 1 } step = { 0.01 } size = { 2 } thumbSize = { 10 } style = { sliderStyle } color = { iconProps . color } aria-label = "Narration volume" styles = { { thumb : { transition : 'transform 0.1s ease' , ':hover' : { transform : 'scale(1.2)' } } , track : { transition : 'all 0.1s ease' } } } />
240243 ) }
241244 </ Group >
242245 < Group gap = "xs" align = "center" wrap = "nowrap" style = { groupMarginRight } >
@@ -276,17 +279,16 @@ export const StandardPlayerWeb = (props: StandardPlayerProps) => {
276279 } }
277280 onMouseEnter = { ( ) => setIsMusicHovered ( true ) }
278281 onMouseLeave = { ( ) => setIsMusicHovered ( false ) }
282+ disabled = { isIOS }
279283 >
280284 Music
281285 </ Button >
282- { isMusicEnabled && (
283- < Tooltip label = "Music Volume" position = "top" withArrow >
284- < Group gap = { 2 } wrap = "nowrap" align = "center" style = { { cursor : 'pointer' } } >
285- < ActionIcon size = "xs" variant = "transparent" color = { iconProps . color } style = { { pointerEvents : 'none' , opacity : 0.7 } } > < LuVolume1 size = { 12 } color = { colorScheme === 'dark' ? theme . white : 'currentColor' } /> </ ActionIcon >
286- < Slider value = { musicVolume } onChange = { onMusicVolumeChange } min = { 0 } max = { 1 } step = { 0.01 } size = { 2 } thumbSize = { 10 } style = { sliderStyle } color = { iconProps . color } aria-label = "Music volume" styles = { { thumb : { transition : 'transform 0.1s ease' , ':hover' : { transform : 'scale(1.2)' } } , track : { transition : 'all 0.1s ease' } } } />
287- < ActionIcon size = "xs" variant = "transparent" color = { iconProps . color } style = { { pointerEvents : 'none' , opacity : 0.7 } } > < LuVolume2 size = { 14 } color = { colorScheme === 'dark' ? theme . white : 'currentColor' } /> </ ActionIcon >
288- </ Group >
286+ { isIOS ? (
287+ < Tooltip label = "Volume control is not available on iOS. Use your device volume buttons." position = "top" withArrow >
288+ < Slider value = { musicVolume } onChange = { onMusicVolumeChange } min = { 0 } max = { 1 } step = { 0.01 } size = { 2 } thumbSize = { 10 } style = { sliderStyle } color = { iconProps . color } aria-label = "Music volume" styles = { { thumb : { transition : 'transform 0.1s ease' , ':hover' : { transform : 'scale(1.2)' } } , track : { transition : 'all 0.1s ease' } } } disabled />
289289 </ Tooltip >
290+ ) : (
291+ < Slider value = { musicVolume } onChange = { onMusicVolumeChange } min = { 0 } max = { 1 } step = { 0.01 } size = { 2 } thumbSize = { 10 } style = { sliderStyle } color = { iconProps . color } aria-label = "Music volume" styles = { { thumb : { transition : 'transform 0.1s ease' , ':hover' : { transform : 'scale(1.2)' } } , track : { transition : 'all 0.1s ease' } } } />
290292 ) }
291293 </ Group >
292294 </ Box >
@@ -318,6 +320,11 @@ export const StandardPlayerWeb = (props: StandardPlayerProps) => {
318320 </ Box >
319321 </ Box >
320322 </ Flex >
323+ { layeredAudioMessage && (
324+ < Alert color = "yellow" style = { { position : 'absolute' , bottom : 16 , left : '50%' , transform : 'translateX(-50%)' , zIndex : 1000 } } >
325+ { layeredAudioMessage }
326+ </ Alert >
327+ ) }
321328 </ Flex >
322329 ) ;
323330} ;
0 commit comments