* Handles calling callbacks and updating caption's current state. * @param {Number} currentTime * @param {Number} lastTime * @memberof Caption
(currentTime, lastTime)
| 70 | * @memberof Caption |
| 71 | */ |
| 72 | updateState(currentTime, lastTime) { |
| 73 | if (this.isFinished()) { |
| 74 | return; |
| 75 | } |
| 76 | if (currentTime > this.lines[this.lineIndex].endTime) { |
| 77 | this.renderer.lineEnd(); |
| 78 | } |
| 79 | while (currentTime > this.lines[this.lineIndex].endTime) { |
| 80 | if ((this.lineIndex++, this.isFinished())) { |
| 81 | return; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | const line = this.lines[this.lineIndex]; |
| 86 | if (currentTime >= line.startTime && lastTime <= line.startTime) { |
| 87 | this.renderer.lineBegin(line); |
| 88 | return; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Checks if caption has completed. |
no test coverage detected