Skip to content

Commit

Permalink
check protocol version
Browse files Browse the repository at this point in the history
  • Loading branch information
cnderrauber committed Apr 28, 2024
1 parent ca30b5c commit 8ed27d7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/room/RTCEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
this.pcManager.onTrack = (ev: RTCTrackEvent) => {
this.emit(EngineEvent.MediaTrackAdded, ev.track, ev.streams[0], ev.receiver);
};

if (!supportOptionalDatachannel(joinResponse.serverInfo?.protocol)) {
this.createDataChannels();
}
}

private setupSignalClientCallbacks() {
Expand Down Expand Up @@ -1390,3 +1394,7 @@ export type EngineEventCallbacks = {
remoteMute: (trackSid: string, muted: boolean) => void;
offline: () => void;
};

function supportOptionalDatachannel(protocol: number | undefined): boolean {
return protocol !== undefined && protocol > 13;
}

0 comments on commit 8ed27d7

Please sign in to comment.