diff --git a/app/components/exp-lookit-video-assent/template.hbs b/app/components/exp-lookit-video-assent/template.hbs index 4b922bbd..4d8786b8 100644 --- a/app/components/exp-lookit-video-assent/template.hbs +++ b/app/components/exp-lookit-video-assent/template.hbs @@ -37,7 +37,9 @@
- {{#if recorderInitializing}} ({{t "please wait, setting up" }}...) + {{#if recorderInitializing}} + + ({{t "please wait, setting up" }}...) {{else}} diff --git a/app/mixins/video-record.js b/app/mixins/video-record.js index 4244f9be..94464135 100644 --- a/app/mixins/video-record.js +++ b/app/mixins/video-record.js @@ -403,7 +403,10 @@ export default Ember.Mixin.create({ $('.video-record-mixin-wait-for-video-text').html(`${expFormat(this.get('waitForUploadMessage'))}`); this.showWaitForVideoCover(); } - return recorder.stop(this.get('maxUploadSeconds') * 1000); + return recorder.stop(this.get('maxUploadSeconds') * 1000) + .catch((e) => { + throw new Error(`Error stopping recorder and uploading: ${e}`); + }); } else { // reject the promise because the recorder is in one of the following states: // - doesn't exist, or is not recording, or has been destroyed @@ -444,6 +447,7 @@ export default Ember.Mixin.create({ .catch((err) => { console.error(`Error playing video: ${err.name}: ${err.message}`); console.trace(); + throw new Error('Error playing video'); }); }, diff --git a/app/services/s3.js b/app/services/s3.js index 94ff4c8b..cba4c84f 100644 --- a/app/services/s3.js +++ b/app/services/s3.js @@ -32,7 +32,11 @@ class S3 { Bucket: this.env.bucket, Key: this.key, ContentType: "video/webm", - }).promise(); + }).promise() + .catch((e) => { + this.logRecordingEvent(`Error creating upload: ${e}`); + throw new Error(`Error creating upload: ${e}`); + }); this.uploadId = createResponse.UploadId; this.logRecordingEvent(`Connection established.`); } @@ -81,6 +85,10 @@ class S3 { }).promise() .then((resp) => { this.logRecordingEvent(`Upload complete: ${resp.Location}`); + }) + .catch((e) => { + this.logRecordingEvent(`Error completing upload: ${e}`); + throw new Error(`Error completing upload: ${e}`); }); } diff --git a/app/services/video-recorder.js b/app/services/video-recorder.js index bfc78321..2af7229b 100644 --- a/app/services/video-recorder.js +++ b/app/services/video-recorder.js @@ -347,14 +347,14 @@ const VideoRecorder = Ember.Object.extend({ resolve(); // skip mic check and resolve the install promise } } else { - reject(); + reject(new Error(`Mic check error: no input stream.`)); } }; const catch_install_error = (err) => { console.error(`Recorder installation error:\n${err.name}: ${err.message}`); console.trace(); - return reject(); + throw new Error(`Recorder installation error: ${err}`); } navigator.mediaDevices.getUserMedia({audio: {noiseSuppression: true}, video: {width: 1280, height: 720, frameRate: 30}}) @@ -458,12 +458,13 @@ const VideoRecorder = Ember.Object.extend({ var recorder = this.get('recorder'); if (recorder) { try { - recorder.stopRecording(); + await recorder.stopRecording(); _this.get('recorder').onRecordingStopped.call(_this); await this.get('s3').completeUpload(); _this._onUploadDone(this.get('recorderId'), this.get('s3').key); // clears the upload timeout, sets isUploaded to true, resolves stop promise } catch (e) { console.warn(`Error stopping video ${_this.get('videoName')}: ${e}`); + throw new Error('Error stopping video.'); } } return _stopPromise; @@ -477,7 +478,7 @@ const VideoRecorder = Ember.Object.extend({ */ pause() { this.get('recorder').getState().then((curr_state) => { - return new RSVP.Promise((resolve, reject) => { + return new RSVP.Promise((resolve) => { if (curr_state == "recording") { this.get('recorder').pauseRecording() .then(() => { @@ -486,7 +487,7 @@ const VideoRecorder = Ember.Object.extend({ .catch((err) => { console.error(`Error pausing recorder:\n${err.name}: ${err.message}`); console.trace(); - reject(); + throw new Error('Error pausing recorder'); }); } else { resolve(); @@ -503,7 +504,7 @@ const VideoRecorder = Ember.Object.extend({ */ resume() { this.get('recorder').getState().then((curr_state) => { - return new RSVP.Promise((resolve, reject) => { + return new RSVP.Promise((resolve) => { if (curr_state == "paused") { this.get('recorder').resumeRecording() .then(() => { @@ -512,7 +513,7 @@ const VideoRecorder = Ember.Object.extend({ .catch((err) => { console.error(`Error resuming recording:\n${err.name}: ${err.message}`); console.trace(); - reject(); + throw new Error('Error resuming recorder'); }); } else { resolve();