aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/RecordingApi.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/RecordingApi.ts')
-rw-r--r--src/client/util/RecordingApi.ts44
1 files changed, 32 insertions, 12 deletions
diff --git a/src/client/util/RecordingApi.ts b/src/client/util/RecordingApi.ts
index fec579486..7592199eb 100644
--- a/src/client/util/RecordingApi.ts
+++ b/src/client/util/RecordingApi.ts
@@ -199,18 +199,19 @@ export class RecordingApi {
return this.videoBox === null
}
- private _isPlaying = false;
+ public _isPlaying = false;
public playMovements = (presentation: Presentation, timeViewed: number = 0, videoBox?: VideoBox): undefined | Error => {
if (presentation.movements === null || this.playFFView === null) {
return new Error('[recordingApi.ts] followMovements() failed: no presentation data or no view')
}
-
+
if (this._isPlaying) {
//return new Error('[recordingApi.ts] playMovements() failed: already playing')
return
}
this._isPlaying = true;
+ console.log('setWatching lol')
Doc.UserDoc().presentationMode = 'watching';
// TODO: consider this bug at the end of the clip on seek
@@ -219,24 +220,43 @@ export class RecordingApi {
const document = this.playFFView.Document
const { movements } = presentation
- this.timers = movements.reduce((arr: NodeJS.Timeout[], movement) => {
- const { panX, panY, time } = movement
+ const filteredMovements = movements.filter(movement => movement.time > timeViewed * 1000)
+
+ document._panX = filteredMovements[0].panX;
+ document._panY = filteredMovements[0].panY;
+
+ this.timers = filteredMovements.map(movement => {
+ const { panX, panY, time } = movement
const timeDiff = time - timeViewed*1000
- if (timeDiff < 0) return arr;
-
- // set the pan to what was stored
- arr.push(setTimeout(() => {
+ return setTimeout(() => {
document._panX = panX;
document._panY = panY;
if (movement === movements[movements.length - 1]) {
- this._isPlaying = false;
- Doc.UserDoc().presentationMode = 'none';
+ // stuff for recording API
+ RecordingApi.Instance._isPlaying = false;
}
- }, timeDiff))
- return arr;
+ }, timeDiff)
}, [])
+ // this.timers = movements.reduce((arr: NodeJS.Timeout[], movement) => {
+ // const { panX, panY, time } = movement
+
+ // const timeDiff = time - timeViewed*1000
+ // if (timeDiff < 0) return arr;
+
+ // // set the pan to what was stored
+ // arr.push(setTimeout(() => {
+ // document._panX = panX;
+ // document._panY = panY;
+ // if (movement === movements[movements.length - 1]) {
+ // // stuff for recording API
+ // RecordingApi.Instance._isPlaying = false;
+ // }
+ // }, timeDiff))
+ // return arr;
+ // }, [])
+
}
// Unfinished code for tracing multiple free form views