1- import { useState , useEffect , useMemo } from "react" ;
1+ import { useState , useEffect } from "react" ;
22import { usePlayerStore } from "../../stores/playerStore" ;
33import { useTranslation } from "react-i18next" ;
44import { formatTime } from "../../utils/formatTime" ;
5- import { checkAudioRecordingSupport , getRecordingUnsupportedMessage } from "../../utils/browserCheck" ;
65import {
76 Play ,
87 Pause ,
@@ -20,11 +19,8 @@ import {
2019 Bookmark ,
2120 ListMusic ,
2221 X ,
23- Mic ,
2422 RotateCcw ,
2523} from "lucide-react" ;
26- import { useShadowingStore } from "../../stores/shadowingStore" ;
27- import { useShadowingRecorder } from "../../hooks/useShadowingRecorder" ;
2824import { Slider } from "../ui/slider" ;
2925import { Button } from "../ui/button" ;
3026import { Plus } from "lucide-react" ;
@@ -69,18 +65,8 @@ export const CombinedControls = () => {
6965 selectedBookmarkId,
7066 } = usePlayerStore ( ) ;
7167
72- const {
73- isShadowingMode,
74- setShadowingMode,
75- isRecording,
76- } = useShadowingStore ( ) ;
77-
78- // Initialize shadowing recorder
79- useShadowingRecorder ( ) ;
80-
8168 const [ rangeValues , setRangeValues ] = useState < [ number , number ] > ( [ 0 , 100 ] ) ;
8269 const [ showABControls , setShowABControls ] = useState ( false ) ;
83-
8470 // Get current media bookmarks for the bookmark button
8571 const bookmarks = getCurrentMediaBookmarks ( ) ;
8672
@@ -94,20 +80,6 @@ export const CombinedControls = () => {
9480 setRangeValues ( [ ( start / duration ) * 100 , ( end / duration ) * 100 ] ) ;
9581 } , [ loopStart , loopEnd , duration ] ) ;
9682
97- // Check if audio recording is supported in this browser
98- const recordingCapabilities = useMemo ( ( ) => checkAudioRecordingSupport ( ) , [ ] ) ;
99- const canRecord = recordingCapabilities . supportsAudioRecording ;
100-
101- // Handle shadowing mode toggle
102- const handleShadowingToggle = ( ) => {
103- if ( ! isShadowingMode && ! canRecord ) {
104- const errorMessage = getRecordingUnsupportedMessage ( recordingCapabilities ) ;
105- toast . error ( errorMessage , { duration : 5000 } ) ;
106- return ;
107- }
108- setShadowingMode ( ! isShadowingMode ) ;
109- } ;
110-
11183 // Toggle play/pause
11284 const togglePlayPause = ( ) => {
11385 setIsPlaying ( ! isPlaying ) ;
@@ -414,23 +386,6 @@ export const CombinedControls = () => {
414386 ) }
415387 </ button >
416388
417- { /* Shadowing toggle button */ }
418- < button
419- onClick = { handleShadowingToggle }
420- className = { `p-2.5 rounded-full transition-all duration-150 ${ isRecording
421- ? "bg-red-600 text-white animate-pulse"
422- : isShadowingMode
423- ? "bg-orange-600 text-white hover:bg-orange-700"
424- : canRecord
425- ? "bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"
426- : "bg-gray-200 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed opacity-50"
427- } `}
428- aria-label = { isShadowingMode ? t ( "shadowing.disable" ) : t ( "shadowing.enable" ) }
429- title = { ! canRecord ? "Audio recording is not supported on this device/browser" : ( isShadowingMode ? t ( "shadowing.disable" ) : t ( "shadowing.enable" ) ) }
430- >
431- < Mic size = { 18 } className = "sm:w-[20px] sm:h-[20px]" />
432- </ button >
433-
434389 < button
435390 onClick = { seekForward }
436391 className = "p-2.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors"
0 commit comments