fix last played timestamp when it is a mousemove event
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
|||||||
ReplayerEvents,
|
ReplayerEvents,
|
||||||
EventType,
|
EventType,
|
||||||
Emitter,
|
Emitter,
|
||||||
|
IncrementalSource,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { Timer, addDelay } from './timer';
|
import { Timer, addDelay } from './timer';
|
||||||
import { needCastInSyncMode } from '../utils';
|
import { needCastInSyncMode } from '../utils';
|
||||||
@@ -174,10 +175,19 @@ export function createPlayerService(
|
|||||||
|
|
||||||
const actions = new Array<actionWithDelay>();
|
const actions = new Array<actionWithDelay>();
|
||||||
for (const event of neededEvents) {
|
for (const event of neededEvents) {
|
||||||
|
let lastPlayedTimestamp = lastPlayedEvent?.timestamp;
|
||||||
if (
|
if (
|
||||||
lastPlayedEvent &&
|
lastPlayedEvent?.type === EventType.IncrementalSnapshot &&
|
||||||
lastPlayedEvent.timestamp < baselineTime &&
|
lastPlayedEvent.data.source === IncrementalSource.MouseMove
|
||||||
(event.timestamp <= lastPlayedEvent.timestamp ||
|
) {
|
||||||
|
lastPlayedTimestamp =
|
||||||
|
lastPlayedEvent.timestamp +
|
||||||
|
lastPlayedEvent.data.positions[0]?.timeOffset;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
lastPlayedTimestamp &&
|
||||||
|
lastPlayedTimestamp < baselineTime &&
|
||||||
|
(event.timestamp <= lastPlayedTimestamp ||
|
||||||
event === lastPlayedEvent)
|
event === lastPlayedEvent)
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user