@@ -6,7 +6,9 @@ import {
|
|||||||
TrackPublishDefaults,
|
TrackPublishDefaults,
|
||||||
VideoPreset,
|
VideoPreset,
|
||||||
VideoPresets,
|
VideoPresets,
|
||||||
|
ExternalE2EEKeyProvider,
|
||||||
} from "livekit-client";
|
} from "livekit-client";
|
||||||
|
import E2EEWorker from "livekit-client/e2ee-worker?worker";
|
||||||
|
|
||||||
const defaultLiveKitPublishOptions: TrackPublishDefaults = {
|
const defaultLiveKitPublishOptions: TrackPublishDefaults = {
|
||||||
audioPreset: AudioPresets.music,
|
audioPreset: AudioPresets.music,
|
||||||
@@ -22,7 +24,16 @@ const defaultLiveKitPublishOptions: TrackPublishDefaults = {
|
|||||||
backupCodec: { codec: "vp8", encoding: VideoPresets.h720.encoding },
|
backupCodec: { codec: "vp8", encoding: VideoPresets.h720.encoding },
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
const e2eeWorker = new E2EEWorker();
|
||||||
|
const e2eeKeyProvider = new ExternalE2EEKeyProvider();
|
||||||
|
e2eeKeyProvider.setKey("not secret password");
|
||||||
|
|
||||||
export const defaultLiveKitOptions: RoomOptions = {
|
export const defaultLiveKitOptions: RoomOptions = {
|
||||||
|
e2ee: {
|
||||||
|
keyProvider: e2eeKeyProvider,
|
||||||
|
worker: e2eeWorker,
|
||||||
|
},
|
||||||
|
|
||||||
// automatically manage subscribed video quality
|
// automatically manage subscribed video quality
|
||||||
adaptiveStream: true,
|
adaptiveStream: true,
|
||||||
|
|
||||||
|
|||||||
@@ -32,12 +32,14 @@ export function useLiveKit(
|
|||||||
return options;
|
return options;
|
||||||
}, [userChoices.video, userChoices.audio]);
|
}, [userChoices.video, userChoices.audio]);
|
||||||
|
|
||||||
|
const roomWithoutProps = useMemo(() => new Room(roomOptions), [roomOptions]);
|
||||||
|
|
||||||
const { room } = useLiveKitRoom({
|
const { room } = useLiveKitRoom({
|
||||||
token: sfuConfig?.jwt,
|
token: sfuConfig?.jwt,
|
||||||
serverUrl: sfuConfig?.url,
|
serverUrl: sfuConfig?.url,
|
||||||
audio: userChoices.audio?.enabled ?? false,
|
audio: userChoices.audio?.enabled ?? false,
|
||||||
video: userChoices.video?.enabled ?? false,
|
video: userChoices.video?.enabled ?? false,
|
||||||
options: roomOptions,
|
room: roomWithoutProps,
|
||||||
});
|
});
|
||||||
|
|
||||||
return room;
|
return room;
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ export function ActiveCall(props: ActiveCallProps) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
livekitRoom.setE2EEEnabled(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RoomContext.Provider value={livekitRoom}>
|
<RoomContext.Provider value={livekitRoom}>
|
||||||
<InCallView {...props} livekitRoom={livekitRoom} />
|
<InCallView {...props} livekitRoom={livekitRoom} />
|
||||||
|
|||||||
Reference in New Issue
Block a user