fresh-air-37123
12/14/2023, 11:35 AMasync initRoom() {
await this.roomToken()
this.room = new Room({
// automatically manage subscribed video quality
adaptiveStream: true,
// optimize publishing bandwidth and CPU for published tracks
dynacast: true,
// default capture settings
videoCaptureDefaults: {
resolution: _*VideoPresets*_._h720_.resolution,
},
});
if (_*location*_.protocol.startsWith("https")) {
this.roomUrl = `wss://${`_*location*_.host}/room``
} else {
this.roomUrl = `ws://${`_*location*_.host}/room``
}
await this.room.prepareConnection(this.roomUrl, this.token);
this.room.on(RoomEvent._TrackSubscribed_, this.handleTrackSubscribed)
.on(RoomEvent._TrackUnsubscribed_, this.handleTrackUnsubscribed)
.on(RoomEvent._ActiveSpeakersChanged_, this.handleActiveSpeakerChange)
.on(RoomEvent._Disconnected_, this.handleDisconnect)
.on(RoomEvent._LocalTrackUnpublished_, this.handleLocalTrackUnpublished);
await this.room.connect(this.roomUrl, this.token)
_*console*_.log('connected to room', this.room.name);
await this.room.localParticipant.enableCameraAndMicrophone();
}