mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-22 21:29:05 +00:00
Merge branch 'fix-mp3-download-while-authenticated' into sara/fix-api-auth
This commit is contained in:
@@ -30,6 +30,7 @@ type RecorderProps = {
|
||||
waveform?: AudioWaveform | null;
|
||||
isPastMeeting: boolean;
|
||||
transcriptId?: string | null;
|
||||
mp3Blob?: Blob | null;
|
||||
};
|
||||
|
||||
export default function Recorder(props: RecorderProps) {
|
||||
@@ -108,11 +109,7 @@ export default function Recorder(props: RecorderProps) {
|
||||
if (waveformRef.current) {
|
||||
const _wavesurfer = WaveSurfer.create({
|
||||
container: waveformRef.current,
|
||||
url: props.transcriptId
|
||||
? `${process.env.NEXT_PUBLIC_API_URL}/v1/transcripts/${props.transcriptId}/audio/mp3`
|
||||
: undefined,
|
||||
peaks: props.waveform?.data,
|
||||
|
||||
hideScrollbar: true,
|
||||
autoCenter: true,
|
||||
barWidth: 2,
|
||||
@@ -146,6 +143,10 @@ export default function Recorder(props: RecorderProps) {
|
||||
|
||||
if (props.isPastMeeting) _wavesurfer.toggleInteraction(true);
|
||||
|
||||
if (props.mp3Blob) {
|
||||
_wavesurfer.loadBlob(props.mp3Blob);
|
||||
}
|
||||
|
||||
setWavesurfer(_wavesurfer);
|
||||
|
||||
return () => {
|
||||
@@ -157,6 +158,12 @@ export default function Recorder(props: RecorderProps) {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!wavesurfer) return;
|
||||
if (!props.mp3Blob) return;
|
||||
wavesurfer.loadBlob(props.mp3Blob);
|
||||
}, [props.mp3Blob]);
|
||||
|
||||
useEffect(() => {
|
||||
topicsRef.current = props.topics;
|
||||
if (!isRecording) renderMarkers();
|
||||
|
||||
Reference in New Issue
Block a user