aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-12-09 12:55:14 -0500
committerbobzel <zzzman@gmail.com>2020-12-09 12:55:14 -0500
commitd63ad57116ef9eb1ec0a4e25aaab5c24d6dbf23b (patch)
tree5d510b4398473e72204617b25a7b84d29145913f
parent4473461d56720e8bdfd540fa67098ebccb29899c (diff)
only load audio waveform data when audio is selected -- should be replaced by something more efficient like a cached bitmap..
-rw-r--r--src/client/views/nodes/AudioBox.tsx9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx
index 447668ee8..f3a430e0b 100644
--- a/src/client/views/nodes/AudioBox.tsx
+++ b/src/client/views/nodes/AudioBox.tsx
@@ -508,6 +508,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent<FieldViewProps, AudioD
// returns the audio waveform
@computed get waveform() {
+ !this._buckets.length && this.props.isSelected() && setTimeout(() => this.buckets());
return <Waveform
color={"darkblue"}
height={this._waveHeight}
@@ -550,18 +551,12 @@ export class AudioBox extends ViewBoxAnnotatableComponent<FieldViewProps, AudioD
});
}
- // Returns the peaks of the audio waveform
- @computed get peaks() {
- return this.buckets();
- }
-
rangeScript = () => AudioBox.RangeScript;
labelScript = () => AudioBox.LabelScript;
render() {
const interactive = SnappingManager.GetIsDragging() || this.active() ? "-interactive" : "";
this._first = true; // for indicating the first marker that is rendered
- this.path && this._buckets.length !== 100 ? this.peaks : null; // render waveform if audio is done recording
const markerDoc = (mark: Doc, script: undefined | (() => ScriptField)) => {
return <DocumentView {...this.props}
Document={mark}
@@ -596,7 +591,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent<FieldViewProps, AudioD
:
<button className={`audiobox-record${interactive}`} style={{ backgroundColor: "black" }}>
RECORD
- </button>}
+ </button>}
</div> :
<div className="audiobox-controls" >
<div className="audiobox-dictation"></div>