fix(ui) - assist check for video and audio

This commit is contained in:
Shekar Siri 2021-08-13 17:27:05 +05:30
parent f1fade81a3
commit 0920f17009

View file

@ -40,22 +40,30 @@ function AssistActions({ toggleChatWindow, userId, calling, peerConnectionStatus
toast.info(`Call was rejected.`);
}
function onError() {
toast.error(`Something went wrong!`);
function onError(e) {
toast.error(e);
}
function call() {
function onCallConnect(lStream) {
setLocalStream(lStream);
setEndCall(() => callPeer(
lStream,
setIncomeStream,
onClose.bind(null, lStream),
onReject,
onError
));
}
function call() {
navigator.mediaDevices.getUserMedia({video:true, audio:true})
.then(lStream => {
setLocalStream(lStream);
setEndCall(() => callPeer(
lStream,
setIncomeStream,
onClose.bind(null, lStream),
onReject,
onError
));
}).catch(onError);
.then(onCallConnect).catch(error => {
onError(error)
navigator.mediaDevices.getUserMedia({audio:true})
.then(onCallConnect)
.catch(onError)
});
}
const inCall = calling !== CallingState.False;