Live SDKs JavaScript v1
Live SDKs JavaScript
Live SDKs
JavaScript
Version 1

Check the settings of a live event

Copy link

After entering a live event as a host using enterAsHost(), the host can view their own media stream before changing the state to ready and allowing participants to enter. The host can specify audio and video devices using the selectVideoInput() and selectAudioInput() methods and call liveEvent.setVideoViewForLiveEvent(videoView, hostId), where videoView must be of HTMLMediaElement type. When the devices aren't specified, the browser's default device is used. Then, the host can establish a connection with the Sendbird server by calling the startStreaming() method to see their own view.

The selectVideoInput() and selectAudioInput() methods accept MediaDeviceInfo as a parameter. You can get MediaDeviceInfo for your devices using getAvailableAudioInputDevices(): MediaDeviceInfo[] and getAvailableVideoInputDevices(): MediaDeviceInfo[].

// Get DeviceInfo list.
SendbirdLive.getAvailableAudioInputDevices();
SendbirdLive.getAvailableVideoInputDevices();

// You can choose audio and video devices to use during the live event. If not specified, the browser's default device is used.  
liveEvent.selectVideoInput(deviceInfo);
liveEvent.selectAudioInput(deviceInfo);

// Set the media for the live event for the host to view their own media stream.
liveEvent.setVideoViewForLiveEvent(videoView, hostId);

// Start streaming.
liveEvent.startStreaming();