Refactor transcription (#476)

* word-level timestamp is not needed for alignment

* remove deprecated code

* fix error when stop recording
This commit is contained in:
an-lee
2024-04-02 14:03:02 +08:00
committed by GitHub
parent f4d1d2a730
commit f0f4319044
4 changed files with 13 additions and 147 deletions

View File

@@ -18,6 +18,7 @@ export const MediaRecorder = () => {
transcription,
currentSegmentIndex,
} = useContext(MediaPlayerProviderContext);
const [player, setPlayer] = useState<WaveSurfer>();
const [access, setAccess] = useState<boolean>(false);
const [duration, setDuration] = useState<number>(0);
const { EnjoyApp } = useContext(AppSettingsProviderContext);
@@ -80,6 +81,7 @@ export const MediaRecorder = () => {
autoCenter: false,
normalize: false,
});
setPlayer(ws);
const record = ws.registerPlugin(RecordPlugin.create());
let startAt = 0;
@@ -113,9 +115,9 @@ export const MediaRecorder = () => {
});
return () => {
clearInterval(interval);
record.stopRecording();
ws?.destroy();
if (interval) clearInterval(interval);
record?.stopRecording();
player?.destroy();
};
}, [ref, isRecording, access, layout?.playerHeight]);