Created
May 28, 2023 07:37
-
-
Save nemo0/d98a78e396fe05bdcb9bac6de357d03f to your computer and use it in GitHub Desktop.
Call.js Default Call Handlers
This file contains 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 setDefaultCallHandlers = (call) => { | |
call.onEstablished = () => { | |
setRinging(false); | |
setConnecting(false); | |
console.log('Call established'); | |
}; | |
call.onConnected = () => { | |
setRinging(false); | |
setConnected(true); | |
setConnecting(false); | |
console.log('Call connected'); | |
}; | |
call.onReconnected = () => { | |
setConnected(true); | |
setConnecting(false); | |
console.log('Call reconnected'); | |
}; | |
call.onReconnecting = () => { | |
setConnected(false); | |
setConnecting(true); | |
console.log('Call reconnecting'); | |
}; | |
call.onEnded = () => { | |
setRinging(false); | |
setConnected(false); | |
setConnecting(false); | |
setCall(null); | |
console.log('Call ended'); | |
}; | |
call.onRemoteAudioSettingsChanged = () => { | |
console.log('Remote audio settings changed'); | |
}; | |
call.onRemoteVideoSettingsChanged = () => { | |
console.log('Remote video settings changed'); | |
}; | |
return call; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment