aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>2022-06-14 17:48:45 -0400
committerMichael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>2022-06-14 17:48:45 -0400
commit83690c334c8d343d6d7560a6aa7f8e7be9cd3639 (patch)
treed4ca610a24f91a95e0fdfbc50ebd2ed8fcbc5ac8 /src
parent9e9a49665e7fc914d3faab07ab13aba272bbec3a (diff)
done for day - get the functionality down. will make code more readable and fix some small bugs tomorrow
Diffstat (limited to 'src')
-rw-r--r--src/client/util/RecordingApi.ts43
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx2
-rw-r--r--src/client/views/nodes/VideoBox.tsx2
3 files changed, 31 insertions, 16 deletions
diff --git a/src/client/util/RecordingApi.ts b/src/client/util/RecordingApi.ts
index 99085e658..4bbaa9a79 100644
--- a/src/client/util/RecordingApi.ts
+++ b/src/client/util/RecordingApi.ts
@@ -12,6 +12,7 @@ import { Id } from "../../fields/FieldSymbols";
import { returnAll } from "../../Utils";
import { ContextExclusionPlugin } from "webpack";
import { DocServer } from "../DocServer";
+import { DocumentView } from "../views/nodes/DocumentView";
type Movement = {
time: number,
@@ -105,10 +106,12 @@ export class RecordingApi {
if (tabbedFFViews.size > this.recordingFFViews.size) {
for (const DashDoc of tabbedDocs) {
if (!this.recordingFFViews.has(DashDoc[Id])) {
- isFFView(DashDoc) && this.addRecordingFFView(DashDoc);
+ if (isFFView(DashDoc)) {
+ this.addRecordingFFView(DashDoc);
- // only one max change, so return
- if (onlyOne) return;
+ // only one max change, so return
+ if (onlyOne) return;
+ }
}
}
}
@@ -134,6 +137,7 @@ export class RecordingApi {
reaction(() => CollectionDockingView.Instance.props.Document.data,
(change) => {
// TODO: consider changing between dashboards
+ console.log('change in tabs', change);
this.updateRecordingFFViewsFromTabs(DocListCast(change), true);
});
@@ -197,20 +201,23 @@ export class RecordingApi {
if (this.recordingFFViews === null) { console.warn('removeAllFFViews on null RecordingApi'); return; }
for (const [id, disposeFunc] of this.recordingFFViews) {
+ console.log('calling dispose func : docId', id);
disposeFunc();
this.recordingFFViews.delete(id);
}
}
private trackMovements = (panX: number, panY: number, docId: string, scale: number = 0) => {
- // ensure we are recording
+ // ensure we are recording to track
if (!this.tracking) {
console.error('[recordingApi.ts] trackMovements(): tracking is false')
return;
}
- // check to see if the presetation is init
+ // check to see if the presetation is init - if not, we are between segments
+ // TODO: make this more clear - tracking should be "live tracking", not always true when the recording api being used (between start and yieldPres)
+ // bacuse tracking should be false inbetween segments high key
if (this.nullPresentation) {
- console.error('[recordingApi.ts] trackMovements(): no presentation')
+ console.warn('[recordingApi.ts] trackMovements(): trying to store movemetns between segments')
return;
}
@@ -236,7 +243,7 @@ export class RecordingApi {
// play movemvents will recreate them when the user resumes the presentation
public pauseMovements = (): undefined | Error => {
if (this.playFFView === null) {
- return new Error('[recordingApi.ts] pauseMovements() failed: no view')
+ // return new Error('[recordingApi.ts] pauseMovements() failed: no view')
}
if (!this._isPlaying) {
@@ -263,7 +270,7 @@ export class RecordingApi {
public _isPlaying = false;
public playMovements = (presentation: Presentation, timeViewed: number = 0, videoBox?: VideoBox): undefined | Error => {
- if (presentation.movements === null || this.playFFView === null) {
+ if (presentation.movements === null) {å //|| this.playFFView === null) {
return new Error('[recordingApi.ts] followMovements() failed: no presentation data or no view')
}
if (this._isPlaying) return;
@@ -296,14 +303,20 @@ export class RecordingApi {
// TODO: optimize only ons-first load
// TODO: make async await
// TODO: make sure the cahce still hs the id
+ // TODO: if they are open, set them to their first move
// this will load the cache, so getCachedREfFields won't have to reach server
DocServer.GetRefFields([...docIds]).then(refFields => {
console.log('refFields', refFields)
- const openTab = (docId: string) => {
+
+ const openTab = (docId: string) : DocumentView | undefined => {
const isInView = DocumentManager.Instance.getDocumentViewById(docId);
if (isInView) { return isInView; }
- const doc = DocServer.GetCachedRefField(docId);
+ const doc = DocServer.GetCachedRefField(docId) as Doc;
+ if (doc == undefined) {
+ console.warn('Doc server cache did not contain docId', docId)
+ return undefined;
+ }
CollectionDockingView.AddSplit(doc, 'right');
return DocumentManager.Instance.getDocumentView(doc);
}
@@ -314,10 +327,12 @@ export class RecordingApi {
return setTimeout(() => {
// open tab if it is not already open
const view = openTab(movement.docId);
- // const ffView = view.CollectionFreeFormDocumentView?.().props.CollectionFreeFormView;
- const collectionFFView = view?.ComponentView;
- // replay the movement
- zoomAndPan(movement, collectionFFView as CollectionFreeFormView);
+ if (view) {
+ const collectionFFView = view.ComponentView;
+ console.log(collectionFFView instanceof CollectionFreeFormView)
+ // replay the movement
+ zoomAndPan(movement, collectionFFView as CollectionFreeFormView);
+ }
// if last movement, presentation is done -> set the instance var
if (movement === filteredMovements[filteredMovements.length - 1]) RecordingApi.Instance._isPlaying = false;
}, timeDiff)
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index a0e0f4f8d..3c5a42b7d 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1011,7 +1011,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
// 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);
+ // (Doc.UserDoc()?.presentationMode === 'none' || Doc.UserDoc()?.presentationMode === 'watching') && RecordingApi.Instance.setPlayFFView(this);
// if (Doc.UserDoc()?.presentationMode === 'watching') {
// RecordingApi.Instance.pauseVideoAndMovements();
// Doc.UserDoc().presentationMode = 'none';
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx
index b14a1f0f6..cf3282d2f 100644
--- a/src/client/views/nodes/VideoBox.tsx
+++ b/src/client/views/nodes/VideoBox.tsx
@@ -366,7 +366,7 @@ export class VideoBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp
this._disposers.reactionDisposer = reaction(() => NumCast(this.layoutDoc._currentTimecode),
time => {
!this._playing && (vref.currentTime = time);
- console.log("vref time = " + vref.currentTime)
+ // console.log("vref time = " + vref.currentTime)
}, { fireImmediately: true });
}
}