mirror of https://github.com/Chocobozzz/PeerTube
Faster transcription segment detection
parent
1acfda0c3c
commit
6d2f5868e0
|
@ -161,8 +161,8 @@ export class VideoTranscriptionComponent implements OnInit, OnChanges {
|
||||||
const entries = parse(content).entries
|
const entries = parse(content).entries
|
||||||
|
|
||||||
this.segmentsStore = entries.map(({ from, to, text }) => {
|
this.segmentsStore = entries.map(({ from, to, text }) => {
|
||||||
const start = Math.ceil(from / 1000)
|
const start = Math.round(from / 1000)
|
||||||
const end = Math.ceil(to / 1000)
|
const end = Math.round(to / 1000)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
start,
|
start,
|
||||||
|
@ -217,7 +217,7 @@ export class VideoTranscriptionComponent implements OnInit, OnChanges {
|
||||||
for (let i = this.segmentsStore.length - 1; i >= 0; i--) {
|
for (let i = this.segmentsStore.length - 1; i >= 0; i--) {
|
||||||
const current = this.segmentsStore[i]
|
const current = this.segmentsStore[i]
|
||||||
|
|
||||||
if (current.start < this.currentTime) {
|
if (current.start <= this.currentTime) {
|
||||||
this.activeSegment = current
|
this.activeSegment = current
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue