aboutsummaryrefslogtreecommitdiff
path: root/src/client/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views')
-rw-r--r--src/client/views/nodes/AudioBox.tsx26
-rw-r--r--src/client/views/nodes/FormattedTextBoxComment.tsx2
-rw-r--r--src/client/views/nodes/WebBox.tsx2
3 files changed, 14 insertions, 16 deletions
diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx
index ea26cc43d..05b9fd14a 100644
--- a/src/client/views/nodes/AudioBox.tsx
+++ b/src/client/views/nodes/AudioBox.tsx
@@ -20,6 +20,8 @@ import { DocumentView } from "./DocumentView";
import { Docs } from "../../documents/Documents";
import { ComputedField } from "../../../new_fields/ScriptField";
+// testing testing
+
interface Window {
MediaRecorder: MediaRecorder;
}
@@ -46,6 +48,7 @@ export class AudioBox extends DocExtendableComponent<FieldViewProps, AudioDocume
_ele: HTMLAudioElement | null = null;
_recorder: any;
_recordStart = 0;
+ _stream: MediaStream | undefined;
public static START = 0;
@observable private static _scrubTime = 0;
@@ -137,12 +140,11 @@ export class AudioBox extends DocExtendableComponent<FieldViewProps, AudioDocume
}
recordAudioAnnotation = () => {
- let gumStream: any;
const self = this;
navigator.mediaDevices.getUserMedia({
audio: true
}).then(function (stream) {
- gumStream = stream;
+ self._stream = stream;
self._recorder = new MediaRecorder(stream);
self.dataDoc[self.props.fieldKey + "-recordingStart"] = new DateField(new Date());
AudioBox.START = new DateField(new Date()).date.getTime();
@@ -154,23 +156,16 @@ export class AudioBox extends DocExtendableComponent<FieldViewProps, AudioDocume
method: 'POST',
body: formData
});
- const json = await res.json();
- json.map(async (file: any) => {
- const path = file.result.accessPaths.agnostic.client;
- const url = Utils.prepend(path);
- // upload to server with known URL
- self.props.Document[self.props.fieldKey] = new AudioField(url);
- });
+ const files = await res.json();
+ const url = Utils.prepend(files[0].result.accessPaths.agnostic.client);
+ // upload to server with known URL
+ self.props.Document[self.props.fieldKey] = new AudioField(url);
};
self._recordStart = new Date().getTime();
- console.log("RECORD START = " + self._recordStart);
runInAction(() => self.audioState = "recording");
setTimeout(self.updateRecordTime, 0);
self._recorder.start();
- setTimeout(() => {
- self.stopRecording();
- gumStream.getAudioTracks()[0].stop();
- }, 60 * 60 * 1000); // stop after an hour?
+ setTimeout(() => self._recorder && self.stopRecording(), 60 * 1000); // stop after an hour
});
}
@@ -183,8 +178,10 @@ export class AudioBox extends DocExtendableComponent<FieldViewProps, AudioDocume
stopRecording = action(() => {
this._recorder.stop();
+ this._recorder = undefined;
this.dataDoc.duration = (new Date().getTime() - this._recordStart) / 1000;
this.audioState = "paused";
+ this._stream?.getAudioTracks()[0].stop();
const ind = AudioBox.ActiveRecordings.indexOf(this.props.Document);
ind !== -1 && (AudioBox.ActiveRecordings.splice(ind, 1));
});
@@ -237,6 +234,7 @@ export class AudioBox extends DocExtendableComponent<FieldViewProps, AudioDocume
</audio>;
}
+ // line 226 is stop button but it doesn't do anything
render() {
const interactive = this.active() ? "-interactive" : "";
return <div className={`audiobox-container`} onContextMenu={this.specificContextMenu}
diff --git a/src/client/views/nodes/FormattedTextBoxComment.tsx b/src/client/views/nodes/FormattedTextBoxComment.tsx
index a3096f60b..61df188f8 100644
--- a/src/client/views/nodes/FormattedTextBoxComment.tsx
+++ b/src/client/views/nodes/FormattedTextBoxComment.tsx
@@ -83,7 +83,7 @@ export class FormattedTextBoxComment {
const keep = e.target && (e.target as any).type === "checkbox" ? true : false;
const textBox = FormattedTextBoxComment.textBox;
if (FormattedTextBoxComment.linkDoc && !keep && textBox) {
- DocumentManager.Instance.FollowLink(FormattedTextBoxComment.linkDoc, textBox.dataDoc,
+ DocumentManager.Instance.FollowLink(FormattedTextBoxComment.linkDoc, textBox.props.Document,
(doc: Doc, maxLocation: string) => textBox.props.addDocTab(doc, e.ctrlKey ? "inTab" : "onRight"));
} else if (textBox && (FormattedTextBoxComment.tooltipText as any).href) {
textBox.props.addDocTab(Docs.Create.WebDocument((FormattedTextBoxComment.tooltipText as any).href, { title: (FormattedTextBoxComment.tooltipText as any).href, _width: 200, _height: 400 }), "onRight");
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index c169d9423..2f8b6167f 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -36,7 +36,7 @@ export class WebBox extends DocAnnotatableComponent<FieldViewProps, WebDocument>
public static LayoutString(fieldKey: string) { return FieldView.LayoutString(WebBox, fieldKey); }
@observable private collapsed: boolean = true;
- @observable private url: string = "";
+ @observable private url: string = "hello";
private _longPressSecondsHack?: NodeJS.Timeout;
private _iframeRef = React.createRef<HTMLIFrameElement>();