aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/AudioBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/AudioBox.tsx')
-rw-r--r--src/client/views/nodes/AudioBox.tsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx
index b51908e20..62958a80b 100644
--- a/src/client/views/nodes/AudioBox.tsx
+++ b/src/client/views/nodes/AudioBox.tsx
@@ -64,8 +64,9 @@ export class AudioBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp
@observable _volume: number = 1;
@observable _muted: boolean = false;
@observable _paused: boolean = false;
+ @observable rawDuration: number = 0; // computed from the length of the audio element when loaded
@computed get recordingStart() { return DateCast(this.dataDoc[this.fieldKey + "-recordingStart"])?.date.getTime(); }
- @computed get rawDuration() { return NumCast(this.dataDoc[`${this.fieldKey}-duration`]); }
+ // @computed get rawDuration() { return NumCast(this.dataDoc[`${this.fieldKey}-duration`]); } // bcz: shouldn't be needed since it's computed from audio element
@computed get links() { return DocListCast(this.dataDoc.links); }
@computed get pauseTime() { return this._pauseEnd - this._pauseStart; } // total time paused to update the correct time
@computed get mediaState() { return this.layoutDoc.mediaState as media_state; }
@@ -490,7 +491,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp
/>
</div>
<div className="timecode-duration">
- {this.timeline && formatTime(Math.round(NumCast(this.timeline?.clipDuration)))}
+ {this.timeline && formatTime(Math.round(this.timeline.clipDuration))}
</div>
</div>
@@ -537,7 +538,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp
className={`audiobox-control${this.props.isContentActive() ? "-interactive" : ""}`}
onLoadedData={action(e =>
(this._ele?.duration && this._ele?.duration !== Infinity) &&
- (this.dataDoc[this.fieldKey + "-duration"] = this._ele?.duration)
+ (this.dataDoc[this.fieldKey + "-duration"] = this.rawDuration = this._ele.duration)
)}
>
<source src={this.path} type="audio/mpeg" />