in src/providers/MeetingProvider/MeetingManager.ts [273:339]
async initializeMeetingSession(
configuration: MeetingSessionConfiguration,
deviceLabels: DeviceLabels | DeviceLabelTrigger = DeviceLabels.AudioAndVideo
): Promise<any> {
const {
simulcastEnabled,
enableWebAudio,
logger: configLogger,
videoUplinkBandwidthPolicy,
videoDownlinkBandwidthPolicy,
reconnectTimeoutMs,
keepLastFrameWhenPaused,
} = this.meetingManagerConfig;
// We are assigning the values from the `meetingManagerConfig` to preserve backward compatibility.
// Please use `this.meetingManagerConfig` for any values going forward.
if (simulcastEnabled) {
configuration.enableUnifiedPlanForChromiumBasedBrowsers = true;
configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers = true;
}
const logger = configLogger
? configLogger
: this.createLogger(configuration);
if (videoUplinkBandwidthPolicy) {
configuration.videoUplinkBandwidthPolicy = videoUplinkBandwidthPolicy;
}
if (videoDownlinkBandwidthPolicy) {
configuration.videoDownlinkBandwidthPolicy = videoDownlinkBandwidthPolicy;
}
if (reconnectTimeoutMs) {
configuration.reconnectTimeoutMs = reconnectTimeoutMs;
}
if (keepLastFrameWhenPaused) {
configuration.keepLastFrameWhenPaused = keepLastFrameWhenPaused;
}
const deviceController = new DefaultDeviceController(logger, {
enableWebAudio,
});
this.meetingSession = new DefaultMeetingSession(
configuration,
logger,
deviceController,
this.eventReporter
);
this.audioVideo = this.meetingSession.audioVideo;
// When an attendee leaves, we remove AudioVideoObservers and nullify AudioVideoFacade and MeetingSession object.
// This results into missing few meeting events triggered with audioVideoDidStop such as meetingEnded, meetingFailed and meetingStartFailed.
// We may also loose audioInputUnselected and videoInputUnselected events as we choose null devices when an attendee leaves.
// When a new AudioVideoFacade object is created remove and re-add the eventDidReceive observer which wont leak.
this.audioVideo.removeObserver(this.eventDidReceiveRef);
this.audioVideo.addObserver(this.eventDidReceiveRef);
this.setupAudioVideoObservers();
this.setupDeviceLabelTrigger(deviceLabels);
await this.listAndSelectDevices(deviceLabels);
this.publishAudioVideo();
this.setupActiveSpeakerDetection();
this.meetingStatus = MeetingStatus.Loading;
this.publishMeetingStatus();
}