From 3feb6c3f22311486828e99dec1db329486a7f3ad Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Thu, 14 Jan 2021 14:42:56 +0200 Subject: [PATCH] Update when reject --- src/App.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index 0c0a03b..b3ede42 100644 --- a/src/App.js +++ b/src/App.js @@ -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;