From e29d86c43a728d08f6cfdad8a24f0a2e0058f43e Mon Sep 17 00:00:00 2001 From: lukasIO Date: Fri, 3 May 2024 13:32:46 +0200 Subject: [PATCH 1/2] Add timestamp to exp timeSyncUpdate --- src/room/track/RemoteTrack.ts | 11 +++++++---- src/room/track/Track.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/room/track/RemoteTrack.ts b/src/room/track/RemoteTrack.ts index c5720148f2..d307e68503 100644 --- a/src/room/track/RemoteTrack.ts +++ b/src/room/track/RemoteTrack.ts @@ -85,10 +85,13 @@ export default abstract class RemoteTrack< registerTimeSyncUpdate() { const loop = () => { this.timeSyncHandle = requestAnimationFrame(() => loop()); - const newTime = this.receiver?.getSynchronizationSources()[0]?.rtpTimestamp; - if (newTime && this.rtpTimestamp !== newTime) { - this.emit(TrackEvent.TimeSyncUpdate, newTime); - this.rtpTimestamp = newTime; + const sources = this.receiver?.getSynchronizationSources()[0]; + if (sources) { + const { timestamp, rtpTimestamp } = sources; + if (rtpTimestamp && this.rtpTimestamp !== rtpTimestamp) { + this.emit(TrackEvent.TimeSyncUpdate, { timestamp, rtpTimestamp }); + this.rtpTimestamp = rtpTimestamp; + } } }; loop(); diff --git a/src/room/track/Track.ts b/src/room/track/Track.ts index 62ff9782b5..881ac9faf1 100644 --- a/src/room/track/Track.ts +++ b/src/room/track/Track.ts @@ -525,5 +525,5 @@ export type TrackEventCallbacks = { upstreamResumed: (track: any) => void; trackProcessorUpdate: (processor?: TrackProcessor) => void; audioTrackFeatureUpdate: (track: any, feature: AudioTrackFeature, enabled: boolean) => void; - timeSyncUpdate: (timestamp: number) => void; + timeSyncUpdate: (update: { timestamp: number; rtpTimestamp: number }) => void; }; From 1ec0570ddf27efb788e78bd1a060423e05049429 Mon Sep 17 00:00:00 2001 From: lukasIO Date: Fri, 3 May 2024 13:34:47 +0200 Subject: [PATCH 2/2] Create loud-fireants-hammer.md --- .changeset/loud-fireants-hammer.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/loud-fireants-hammer.md diff --git a/.changeset/loud-fireants-hammer.md b/.changeset/loud-fireants-hammer.md new file mode 100644 index 0000000000..f5bebb59f3 --- /dev/null +++ b/.changeset/loud-fireants-hammer.md @@ -0,0 +1,5 @@ +--- +"livekit-client": patch +--- + +Add timestamp to exp timeSyncUpdate