Skip to content

Instantly share code, notes, and snippets.

@rebelchris
Last active January 23, 2021 15:07
Show Gist options
  • Save rebelchris/29c1dd160bad608094f77dac136c05d1 to your computer and use it in GitHub Desktop.
Save rebelchris/29c1dd160bad608094f77dac136c05d1 to your computer and use it in GitHub Desktop.
Start basic call function
async function startBasicCall() {
join().then(() => {
startVideo();
startAudio();
rtc.client.on("user-published", async (user, mediaType) => {
await rtc.client.subscribe(user, mediaType);
remote.classList.remove("waiting");
if (mediaType === "video") {
const remoteVideoTrack = user.videoTrack;
remoteVideoTrack.play("remote");
}
if (mediaType === "audio") {
const remoteAudioTrack = user.audioTrack;
remoteAudioTrack.play();
}
});
});
btnStop.classList.remove("hidden");
btnStart.classList.add("hidden");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment