Update when reject

This commit is contained in:
Sergiu Toma 2021-01-14 14:42:56 +02:00
parent 67afec48c1
commit 3feb6c3f22
1 changed files with 8 additions and 2 deletions

View File

@ -89,7 +89,7 @@ class App extends Component {
origin_asset_type_name: this.state.user.user_role.name,
origin_asset_name: this.state.user.name,
video_call_id: parseDate.video_call_id,
answer: 'YES'
answer: 'accepted' // answer: 'rejected'
}));
}
@ -101,6 +101,12 @@ class App extends Component {
// Handler for 'notify-answer'
if(parseDate.type === 'notify-answer') {
if(parseDate.answer === 'rejected') {
this.closeVideo()
return
}
// Create media stream
navigator.mediaDevices.getUserMedia(streamConstraints).then(stream => {
console.log('Created getUserMedia', stream);
@ -245,7 +251,7 @@ class App extends Component {
}
cleanVideoStreams = () => {
this.state.rtcPeerConnection.close();
this.state.rtcPeerConnection != null && this.state.rtcPeerConnection.close();
this.setState({ callId: null, rtcPeerConnection: null });
localVideo.srcObject = null;
remoteVideo.srcObject = null;