diff --git a/packages/livekit-rtc/src/index.ts b/packages/livekit-rtc/src/index.ts index 7d131a3a..50728c46 100644 --- a/packages/livekit-rtc/src/index.ts +++ b/packages/livekit-rtc/src/index.ts @@ -36,7 +36,14 @@ export { TrackSource, } from '@livekit/rtc-ffi-bindings'; export { VideoBufferType, VideoCodec, VideoRotation } from '@livekit/rtc-ffi-bindings'; -export { ConnectError, Room, RoomEvent, type RoomOptions, type RtcConfiguration } from './room.js'; +export { + ConnectError, + Room, + RoomEvent, + type RoomDataStreamOptions, + type RoomOptions, + type RtcConfiguration, +} from './room.js'; export { RpcError, type PerformRpcParams, type RpcInvocationData } from './rpc.js'; export { LocalAudioTrack, diff --git a/packages/livekit-rtc/src/room.ts b/packages/livekit-rtc/src/room.ts index 6ee23de0..b9e4798e 100644 --- a/packages/livekit-rtc/src/room.ts +++ b/packages/livekit-rtc/src/room.ts @@ -29,6 +29,7 @@ import { type IceServer, IceTransportType, type ReadyForRoomEventResponse, + RoomDataStreamOptions, type RoomInfo, type SimulateScenarioCallback, type SimulateScenarioKind, @@ -58,6 +59,8 @@ import { RemoteTrackPublication } from './track_publication.js'; import type { ChatMessage } from './types.js'; import { bigIntToNumber } from './utils.js'; +export { RoomDataStreamOptions }; + export interface RtcConfiguration { iceTransportType: IceTransportType; continualGatheringPolicy: ContinualGatheringPolicy; @@ -273,6 +276,13 @@ export class Room extends (EventEmitter as new () => TypedEmitter */ async connect(url: string, token: string, opts?: RoomOptions) { const options = { ...defaultRoomOptions, ...opts }; + // The Node SDK still implements data streams in TypeScript on top of raw FFI + // packets, so always advertise only legacy (v1) data stream support to other + // clients, preserving any other data stream options provided by the user. + options.dataStream = new RoomDataStreamOptions({ + ...options.dataStream, + useLegacyClientImplementation: true, + }); const e2eeEnabled = options.encryption || options.e2ee; const e2eeOptions = options.encryption ? { ...defaultE2EEOptions, ...options.encryption }