Last active
January 23, 2021 15:07
-
-
Save rebelchris/29c1dd160bad608094f77dac136c05d1 to your computer and use it in GitHub Desktop.
Start basic call function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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