MCPcopy
hub / github.com/iChochy/NCE / updateDuration

Method updateDuration

js/ReadingSystem.js:595–619  ·  view source on GitHub ↗

* 更新音频时长

()

Source from the content-addressed store, hash-verified

593 * 更新音频时长
594 */
595 updateDuration() {
596 if (!this.dom.audioPlayer) return;
597
598 if (this.dom.duration) {
599 setText(this.dom.duration, formatTime(this.dom.audioPlayer.duration));
600 }
601
602 if (
603 Number.isFinite(this.state.savedPlayTime) &&
604 this.state.savedPlayTime > 0 &&
605 this.dom.audioPlayer.duration
606 ) {
607 const targetTime = Math.min(
608 this.state.savedPlayTime,
609 this.dom.audioPlayer.duration - 0.1
610 );
611
612 if (Number.isFinite(targetTime)) {
613 this.dom.audioPlayer.currentTime = targetTime;
614 }
615
616 this.state.savedPlayTime = 0;
617 this.updateProgress();
618 }
619 }
620
621 /**
622 * 更新播放按钮状态

Callers 1

bindPlayerControlsMethod · 0.95

Calls 3

updateProgressMethod · 0.95
setTextFunction · 0.90
formatTimeFunction · 0.90

Tested by

no test coverage detected