Skip to content

Commit e185e00

Browse files
author
dimaspirit
committed
QBWEBSDK-210
1 parent db40e4b commit e185e00

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

samples/webrtc/app.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
currentSession: {},
122122
mainVideo: 0
123123
},
124+
isDeviceAccess = true,
124125
takedCallCallee = [],
125126
remoteStreamCounter = 0,
126127
authorizationing = false,
@@ -298,17 +299,19 @@
298299

299300
$(ui.modal.income_call).modal('hide');
300301

301-
ui.hideCallBtn();
302-
303302
document.getElementById(ui.sounds.rington).pause();
304303

305304
app.currentSession.getUserMedia(mediaParams, function(err, stream) {
306305
if (err) {
307306
ui.updateMsg({msg: 'device_not_found', obj: {name: app.caller.full_name}});
307+
isDeviceAccess = false;
308+
app.currentSession.stop({});
308309
} else {
309310
var opponents = [app.currentSession.initiatorID],
310311
compiled = _.template( $('#callee_video').html() );
311312

313+
ui.hideCallBtn();
314+
312315
/** get all opponents */
313316
app.currentSession.opponentsIDs.forEach( function(userID, i, arr) {
314317
if(userID != app.currentSession.currentUserID){
@@ -462,10 +465,15 @@
462465

463466
ui.showCallBtn();
464467

465-
if(session.opponentsIDs.length > 1) {
466-
ui.updateMsg({msg: 'call_stop', obj: {name: app.caller.full_name}});
468+
if(!isDeviceAccess) {
469+
isDeviceAccess = true;
470+
} else {
471+
if(session.opponentsIDs.length > 1) {
472+
ui.updateMsg({msg: 'call_stop', obj: {name: app.caller.full_name}});
473+
}
467474
}
468475

476+
469477
/** delete blob from myself video */
470478
document.getElementById('localVideo').src = '';
471479

0 commit comments

Comments
 (0)