Created
November 14, 2021 06:08
-
-
Save hieptl/c23417d4968eef40b5c56bc8c8225ff0 to your computer and use it in GitHub Desktop.
Main.js - Server - Direct Call - Discord Clone
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
... | |
const startDirectCall = () => { | |
if (cometChat && selectedChannel && selectedChannelType === 2) { | |
const sessionID = selectedChannel.guid; | |
const audioOnly = false; | |
const defaultLayout = true; | |
const callSettings = new cometChat.CallSettingsBuilder() | |
.enableDefaultLayout(defaultLayout) | |
.setSessionID(sessionID) | |
.setIsAudioOnlyCall(audioOnly) | |
.build(); | |
const callSceen = document.getElementById("call__screen"); | |
callSceen.classList.add('call__screen--active'); | |
cometChat.startCall( | |
callSettings, | |
document.getElementById("call__screen"), | |
new cometChat.OngoingCallListener({ | |
onUserListUpdated: userList => { | |
}, | |
onCallEnded: call => { | |
callSceen.classList.remove('call__screen--active'); | |
setSelectedChannelType(null); | |
}, | |
onError: error => { | |
callSceen.classList.remove('call__screen--active'); | |
setSelectedChannelType(null); | |
}, | |
onMediaDeviceListUpdated: deviceList => { | |
}, | |
onUserMuted: (userMuted, userMutedBy) => { | |
}, | |
onScreenShareStarted: () => { | |
}, | |
onScreenShareStopped: () => { | |
} | |
}) | |
); | |
} | |
}; | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment