fix first play check
This commit is contained in:
@@ -119,10 +119,10 @@ export class Replayer {
|
|||||||
private elementStateMap!: Map<INode, ElementState>;
|
private elementStateMap!: Map<INode, ElementState>;
|
||||||
|
|
||||||
private imageMap: Map<eventWithTime, HTMLImageElement> = new Map();
|
private imageMap: Map<eventWithTime, HTMLImageElement> = new Map();
|
||||||
|
|
||||||
/** The first time the player is playing. */
|
/** The first time the player is playing. */
|
||||||
private firstPlay = true;
|
private firstPlayedEvent: eventWithTime | null = null;
|
||||||
|
|
||||||
private newDocumentQueue: addedNodeMutation[] = [];
|
private newDocumentQueue: addedNodeMutation[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -250,9 +250,10 @@ export class Replayer {
|
|||||||
if (firstFullsnapshot) {
|
if (firstFullsnapshot) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// when something has been played, there is no need to rebuild poster
|
// when something has been played, there is no need to rebuild poster
|
||||||
if (this.timer.timeOffset > 0) {
|
if (this.firstPlayedEvent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.firstPlayedEvent = firstFullsnapshot;
|
||||||
this.rebuildFullSnapshot(
|
this.rebuildFullSnapshot(
|
||||||
firstFullsnapshot as fullSnapshotEvent & { timestamp: number },
|
firstFullsnapshot as fullSnapshotEvent & { timestamp: number },
|
||||||
);
|
);
|
||||||
@@ -463,8 +464,7 @@ export class Replayer {
|
|||||||
case EventType.FullSnapshot:
|
case EventType.FullSnapshot:
|
||||||
castFn = () => {
|
castFn = () => {
|
||||||
// Don't build a full snapshot during the first play through since we've already built it when the player was mounted.
|
// Don't build a full snapshot during the first play through since we've already built it when the player was mounted.
|
||||||
if (this.firstPlay) {
|
if (this.firstPlayedEvent && this.firstPlayedEvent === event) {
|
||||||
this.firstPlay = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.rebuildFullSnapshot(event, isSync);
|
this.rebuildFullSnapshot(event, isSync);
|
||||||
|
|||||||
Reference in New Issue
Block a user