fix: set the end position to the start position, when the end position of audio less than start position

This commit is contained in:
Zyronon
2025-09-16 05:33:28 +00:00
parent c5d1dd9508
commit 85a5297130

View File

@@ -262,7 +262,7 @@ function recordStart() {
sentenceAudioRef.play()
}
editSentence.audioPosition[0] = Number(sentenceAudioRef.currentTime.toFixed(2))
if (editSentence.audioPosition[0] > editSentence.audioPosition[1]) {
if (editSentence.audioPosition[0] > editSentence.audioPosition[1] && editSentence.audioPosition[1] !== 0) {
editSentence.audioPosition[1] = editSentence.audioPosition[0]
}
}
@@ -306,7 +306,7 @@ function setStartTime(val: Sentence, i: number, j: number) {
} else {
val.audioPosition[0] = Number(Number(audioRef.currentTime).toFixed(2))
}
if (val.audioPosition[0] > val.audioPosition[1]) {
if (val.audioPosition[0] > val.audioPosition[1] && val.audioPosition[1] !== 0) {
val.audioPosition[1] = val.audioPosition[0]
}
}