File size: 1,055 Bytes
4148927
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import React from 'react';
import { useAudioRecorder } from '../hooks/useAudioRecorder';

export const AudioControls: React.FC = () => {
    const { isRecording, audioURL, startRecording, stopRecording, playRecording } = useAudioRecorder();

    return (
        <div className="audio-controls">
            {!isRecording ? (
                <button
                    onClick={startRecording}
                    className="record-button"
                >
                    🎤 Démarrer l'enregistrement
                </button>
            ) : (
                <button
                    onClick={stopRecording}
                    className="stop-button"
                >
                    ⏹️ Arrêter l'enregistrement
                </button>
            )}

            {audioURL && (
                <button
                    onClick={playRecording}
                    className="play-button"
                >
                    ▶️ Écouter l'enregistrement
                </button>
            )}
        </div>
    );
};