Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/ts-client/src/FishjamClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export class FishjamClient<PeerMetadata = GenericMetadata, ServerMetadata = Gene

private reconnectManager: ReconnectManager<PeerMetadata, ServerMetadata>;
private peerMessageQueue: MessageQueue;
private receiveMediaEventChain: Promise<void> = Promise.resolve();

private sendStatisticsInterval: NodeJS.Timeout | undefined = undefined;

Expand Down Expand Up @@ -230,7 +231,12 @@ export class FishjamClient<PeerMetadata = GenericMetadata, ServerMetadata = Gene
} else if (data.authRequest) {
this.logger.warn('Received unexpected control message: authRequest');
} else if (serverMediaEvent) {
this.webrtc?.receiveMediaEvent(ServerMediaEvent.encode(serverMediaEvent).finish());
const encodedEvent = ServerMediaEvent.encode(serverMediaEvent).finish();
this.receiveMediaEventChain = this.receiveMediaEventChain
.catch((e) => {
this.logger.warn(`receiveMediaEvent failed: ${e}`);
})
.finally(() => this.webrtc?.receiveMediaEvent(encodedEvent));
}
} catch (e) {
this.logger.warn(`Received invalid control message, error: ${e}`);
Expand Down Expand Up @@ -977,6 +983,7 @@ export class FishjamClient<PeerMetadata = GenericMetadata, ServerMetadata = Gene
}
this.websocket = null;
this.webrtc = null;
this.receiveMediaEventChain = Promise.resolve();
this.cameraStream = new MediaStream();
this.screenShareStream = new MediaStream();
this.trackIdToTrack.clear();
Expand Down
Loading