Quick start
Installation
CDN
Include the following line before the </head>
tag
<script src="https://cdn.ytel.com/video-sdk/ytel-video.min.js"></script>
Usage
Full Options
const ytelVideo = new YtelVideo();
const config = {
audio: true,
video: true,
localVideoElement: document.getElementById('localVideo'),
remoteVideoElement: document.getElementById('remoteVideo'),
};
ytelVideo.connect(document.getElementById('roomToken').value, config);
As defined in that sample, the following parameters can be configured:
audio
: Boolean. True for enabling audio. Default is true.video
: Boolean. True for enabling video. Default is true.localVideoElement
: HTMLVideoElement. Contains the element that will display the local video. Default is null.remoteVideoElement
: HTMLVideoElement. Contains the element that will display the remote video. Default is null.
Methods
ytelVideo.leave();
connect(roomToken, config)
: Connects to the room.roomToken
: String. Contains the room token.config
: Object. Contains the configuration.
join()
: Joins the room.leave()
: Leaves the room.mute()
: Mutes the audio.unmute()
: Unmutes the audio.toggleMute()
: Toggles the audio mute.muteVideo()
: Turn off local video.unmuteVideo()
: Turn on local video.toggleMuteVideo()
: Toggles the local video mute.
Events
ytelVideo.on('connected', () => {
console.log('connected');
});