Skip to content

Commit 2070370

Browse files
author
dimaspirit
committed
additional changes
1 parent e1da89c commit 2070370

File tree

4 files changed

+45
-38
lines changed

4 files changed

+45
-38
lines changed

samples/webrtc/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ <h4>Call from <strong class="j-ic_initiator"></strong></h4>
220220
</script>
221221

222222
<script type="text/template" id="device_not_found">
223-
Error: devices (camera or microphone) are not found.
223+
<span>Error: devices (camera or microphone) are not found.</span>
224224
&emsp;Login&nbsp;in&nbsp;as&nbsp;<%=name%>
225225
<button class='fw-link j-logout'>Logout</button>
226226
</script>

samples/webrtc/js/app.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,14 @@
119119
}
120120
}
121121

122-
function checkAccessPermission(err) {
123-
if(err && err.name === 'PermissionDeniedError' && !err.message) {
124-
alert('Failed to get access to your camera or microphone. Please check your hardware configuration.');
125-
} else if(err) {
126-
alert(err.message);
122+
function showErrorAccessPermission(error) {
123+
var errorTitle = 'Error: ',
124+
errorMsg = 'Failed to get access to your camera or microphone. Please check your hardware configuration.';
125+
126+
if(error && error.message) {
127+
alert(errorTitle + error.message);
128+
} else {
129+
alert(errorTitle + errorMsg);
127130
}
128131
}
129132

@@ -136,7 +139,7 @@
136139
/** Before use WebRTC checking WebRTC is avaible */
137140
if (!QB.webrtc) {
138141
qbApp.MsgBoard.update('webrtc_not_avaible');
139-
alert(window.MESSAGES.webrtc_not_avaible);
142+
alert('Error: ' + window.MESSAGES.webrtc_not_avaible);
140143
return;
141144
}
142145

@@ -246,18 +249,14 @@
246249

247250
app.currentSession.getUserMedia(mediaParams, function(err, stream) {
248251
if (err || !stream.getAudioTracks().length || !stream.getVideoTracks().length) {
249-
if(err && err.name === 'PermissionDeniedError' && !err.message) {
250-
alert('Failed to get access to your camera or microphone. Please check your hardware configuration.');
251-
} else if(err) {
252-
alert(err.message);
253-
}
252+
showErrorAccessPermission(err);
254253

255-
qbApp.MsgBoard.update('device_not_found', {name: app.caller.full_name});
254+
qbApp.MsgBoard.update('device_not_found', {name: app.caller.full_name}, true);
256255
app.currentSession.stop({});
257256
} else {
258257
app.currentSession.call({}, function(error) {
259258
if(error) {
260-
checkAccessPermission(error);
259+
console.warn(error.detail);
261260
} else {
262261
var compiled = _.template( $('#callee_video').html() );
263262

@@ -310,9 +309,9 @@
310309

311310
app.currentSession.getUserMedia(mediaParams, function(err, stream) {
312311
if (err || !stream.getAudioTracks().length || !stream.getVideoTracks().length) {
313-
checkAccessPermission(err);
312+
showErrorAccessPermission(err);
314313

315-
qbApp.MsgBoard.update('device_not_found', {name: app.caller.full_name});
314+
qbApp.MsgBoard.update('device_not_found', {name: app.caller.full_name}, true);
316315
isDeviceAccess = false;
317316
app.currentSession.stop({});
318317
} else {

samples/webrtc/js/msgBoard.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@
1313
/**
1414
* [updateMsg]
1515
* @param {[String]} msg_title [key for MESSAGES object / id of template]
16-
* @param {[Objetc]} params [custom params for compiled template]
16+
* @param {[Object]} params [custom params for compiled template]
17+
* @param {[boolean]} isError [flag is Error - add className to html]
1718
*/
18-
var updateMsg = function(msg_title, params) {
19+
var updateMsg = function(msg_title, params, isError) {
1920
var msg = '',
20-
msgFrag = document.createElement('div');
21+
msgFrag = document.createElement('div'),
22+
className = 'fw-inner';
23+
24+
if(isError) {
25+
className += ' error';
26+
}
27+
28+
msgFrag.className = className;
2129

22-
msgFrag.className = 'fw-inner';
2330
/**
2431
* In first we trying found msg in MESSAGES object
2532
* then tpl with id like msg_title
@@ -49,4 +56,4 @@
4956
*/
5057
window.qbApp = window.qbApp || {};
5158
window.qbApp.MsgBoard = msgBoard;
52-
}(window, jQuery, _));
59+
}(window, jQuery, _));

samples/webrtc/styles.css

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ b, u, i, center,
1010
dl, dt, dd, ol, ul, li,
1111
fieldset, form, label, legend,
1212
table, caption, tbody, tfoot, thead, tr, th, td,
13-
article, aside, canvas, details, embed,
14-
figure, figcaption, footer, header, hgroup,
13+
article, aside, canvas, details, embed,
14+
figure, figcaption, footer, header, hgroup,
1515
menu, nav, output, ruby, section, summary,
1616
time, mark, audio, video {
1717
margin: 0;
@@ -31,7 +31,7 @@ body {
3131
.fw-link {
3232
display: inline-block;
3333
position: relative;
34-
34+
3535
color: #025fca;
3636
/* reset */
3737
border: none;
@@ -172,6 +172,10 @@ body {
172172
color: #808080;
173173
}
174174

175+
.msg_board .error span {
176+
color: #ff2d55;
177+
}
178+
175179
.msg_board .fw-link {
176180
padding: 0;
177181
margin: 0 0 0 10px;
@@ -201,7 +205,7 @@ body {
201205
z-index: 9;
202206
}
203207

204-
/**
208+
/**
205209
* USERS
206210
*/
207211
.users {
@@ -280,18 +284,18 @@ body {
280284
display: block;
281285
width: 28px;
282286
height: 28px;
283-
287+
284288
position: absolute;
285289
top: -3px;
286290
right: -3px;
287-
291+
288292
background: url('images/ic_remove.svg') center no-repeat;
289293
background-size: cover;
290294
border-radius: 50%;
291-
295+
292296
color: #fff;
293297
line-height: 16px;
294-
298+
295299
box-shadow: inset 0 0 3px 3px rgba(255,255,255,1);
296300

297301
visibility: hidden;
@@ -322,7 +326,7 @@ body {
322326
width: 100%;
323327
margin: 0 0 20px 0;
324328
padding: 10px 25px;
325-
329+
326330
font-size: 18px;
327331
font-weight: 600;
328332
color: #025fca;
@@ -423,7 +427,7 @@ body {
423427
top: 8px;
424428
left: 10px;
425429
padding: 10px;
426-
430+
427431
border-radius: 8px;
428432
background: rgba(0,0,0, .5);
429433
color: #fff;
@@ -452,12 +456,12 @@ body {
452456
display: inline-block;
453457
position: relative;
454458
width: 50%;
455-
459+
456460
margin-bottom: 15px;
457-
461+
458462
padding-top: 14px;
459463
padding-right: 10px;
460-
464+
461465
vertical-align: top;
462466

463467
font-size: 14px;
@@ -472,7 +476,7 @@ body {
472476
position: absolute;
473477
width: 100%;
474478
top: -14px;
475-
479+
476480
font-size: 11px;
477481
text-transform: uppercase;
478482
text-align: center;
@@ -510,6 +514,3 @@ body {
510514
width: 20%;
511515
}
512516
}
513-
514-
515-

0 commit comments

Comments
 (0)