aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>2022-06-15 13:50:33 -0400
committerMichael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>2022-06-15 13:50:33 -0400
commit5972716e64fd9a006fa2139a40b03c21b503dd04 (patch)
treee495f5661f848790d8f281d272704f3275727952
parentbd35489c33501ff465e6ddd3cb943a748bfe546e (diff)
fix small disposer bug and reintroduce pausing on interaction
-rw-r--r--src/client/util/RecordingApi.ts26
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx4
2 files changed, 18 insertions, 12 deletions
diff --git a/src/client/util/RecordingApi.ts b/src/client/util/RecordingApi.ts
index 48ea12fd9..ae5431a03 100644
--- a/src/client/util/RecordingApi.ts
+++ b/src/client/util/RecordingApi.ts
@@ -57,7 +57,7 @@ export class RecordingApi {
this.absoluteStart = -1;
// used for tracking movements in the view frame
- this.recordingFFViews = null;
+ this.recordingFFViews = new Map();
this.tabChangeDisposeFunc = null;
// for now, set playFFView
@@ -126,9 +126,8 @@ export class RecordingApi {
}
}
- public start = (meta?: Object) => {
+ public initTabTracker = () => {
// init the dispose funcs on the page
- this.recordingFFViews = new Map();
const docList = DocListCast(CollectionDockingView.Instance.props.Document.data);
this.updateRecordingFFViewsFromTabs(docList);
@@ -140,7 +139,9 @@ export class RecordingApi {
console.log('change in tabs', change);
this.updateRecordingFFViewsFromTabs(DocListCast(change), true);
});
+ }
+ public start = (meta?: Object) => {
// update the presentation mode
Doc.UserDoc().presentationMode = 'recording';
@@ -238,10 +239,7 @@ export class RecordingApi {
// play movemvents will recreate them when the user resumes the presentation
public pauseMovements = (): undefined | Error => {
- if (!this._isPlaying) {
- //return new Error('[recordingApi.ts] pauseMovements() failed: not playing')
- return
- }
+ if (!this._isPlaying) { console.warn('[recordingApi.ts] pauseMovements(): already on paused'); return;}
this._isPlaying = false
// TODO: set userdoc presentMode to browsing
this.timers?.map(timer => clearTimeout(timer))
@@ -250,6 +248,7 @@ export class RecordingApi {
}
private videoBoxDisposeFunc: IReactionDisposer | null = null;
+ private videoBox: VideoBox | null = null;
setVideoBox = (videoBox: VideoBox) => {
console.log('setVideoBox', videoBox);
@@ -258,20 +257,25 @@ export class RecordingApi {
reaction(() => ({ playing: videoBox._playing, timeViewed: videoBox.player?.currentTime || 0 }),
({ playing, timeViewed }) =>
playing ? this.playMovements(videoBox.presentation, timeViewed) : this.pauseMovements()
- );
+ );
+ this.videoBox = videoBox;
}
removeVideoBox = () => {
if (this.videoBoxDisposeFunc == null) { console.warn('removeVideoBox on null videoBox'); return; }
this.videoBoxDisposeFunc();
+
+ this.videoBox = null;
+ this.videoBoxDisposeFunc = null;
}
// by calling pause on the VideoBox, the pauseMovements will be called
- public pauseVideoAndMovements = () => {
- // this.videoBox?.Pause()
+ public pauseFromInteraction = () => {
+ Doc.UserDoc().presentationMode = 'none';
+ this.videoBox?.Pause();
- this.pauseMovements()
+ this.pauseMovements();
// return this.videoBox == null
}
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 3c5a42b7d..7db3b1482 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1009,7 +1009,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
// if (Doc.UserDoc()?.presentationMode === 'recording') {
// // RecordingApi.Instance.setRecordingFFView(this);
// console.log('setRecordingFFView', this);
- // }
+ // }
// TODO: make this based off the specific recording FFView
// (Doc.UserDoc()?.presentationMode === 'none' || Doc.UserDoc()?.presentationMode === 'watching') && RecordingApi.Instance.setPlayFFView(this);
// if (Doc.UserDoc()?.presentationMode === 'watching') {
@@ -1017,6 +1017,8 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
// Doc.UserDoc().presentationMode = 'none';
// // RecordingApi.Instance.pauseMovements()
// }
+ // this is the easiest way to do this -> will talk with Bob about using mobx to do this to remove this line of code.
+ if (Doc.UserDoc()?.presentationMode === 'watching') RecordingApi.Instance.pauseFromInteraction();
if (!this.isAnnotationOverlay && clamp) {
// this section wraps the pan position, horizontally and/or vertically whenever the content is panned out of the viewing bounds