Skip to content

Commit 6a27eca

Browse files
authored
webrtc sample issues (#298)
* Recording time 10 min. max * QBWEBSDK-181 * clean up
1 parent 825c782 commit 6a27eca

File tree

4 files changed

+45285
-8
lines changed

4 files changed

+45285
-8
lines changed

quickblox.min.js

Lines changed: 45250 additions & 1 deletion
Large diffs are not rendered by default.

samples/webrtc/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ <h4 class="caller__name">
279279

280280
<button class="caller__frames_acts_btn_record j-record" alt="record video">
281281
</button>
282+
283+
<p class="sample_info">
284+
The recording time is 10 minutes maximum.
285+
Check out a <a href="https://github.com/QuickBlox/javascript-media-recorder" target="_blank">recorder</a> if want more.
286+
</p>
282287
</div>
283288

284289
<div class="caller__frames_fl">

samples/webrtc/js/app.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@
99
};
1010

1111
var recorder = null;
12+
var recorderTimeoutID;
1213

1314
var recorderOpts = {
1415
onstart: function onStartRecord() {
15-
console.log('[QB Recorder] onStartRecording');
1616
$('.j-record').addClass('active');
17+
18+
recorderTimeoutID = setTimeout(function() {
19+
if(recorder) {
20+
recorder.stop();
21+
}
22+
}, 600000); // 10min
1723
},
1824
onstop: function(blob) {
19-
console.log('[QB Recorder] onStopRecording');
2025
$('.j-record').removeClass('active');
2126

2227
var down = confirm('Do you want to download video?');
@@ -26,6 +31,7 @@
2631
}
2732

2833
recorder = null;
34+
clearTimeout(recorderTimeoutID);
2935
},
3036
onerror: function(error) {
3137
console.error('Recorder error', error);
@@ -73,7 +79,7 @@
7379
var remoteStreamCounter = 0;
7480

7581
function closeConn(userId) {
76-
if(recorder) {
82+
if(recorder && recorderTimeoutID) {
7783
recorder.stop();
7884
}
7985

@@ -222,14 +228,20 @@
222228
return [item.name, item.value.trim()];
223229
}));
224230

231+
/** Check internet connection */
232+
if(!window.navigator.onLine) {
233+
alert(CONFIG.MESSAGES['no_internet']);
234+
return false;
235+
}
236+
225237
if(localStorage.getItem('isAuth')) {
226238
$('#already_auth').modal();
227239
return false;
228240
}
229241

230242
$form.addClass('join-wait');
231243

232-
app.helpers.join(data).then(function (user) {
244+
app.helpers.join(data).then(function(user) {
233245
app.caller = user;
234246

235247
QB.chat.connect({
@@ -329,8 +341,9 @@
329341
if ($btn.hasClass('hangup')) {
330342
if(!_.isEmpty(app.currentSession)) {
331343

332-
if(recorder) {
344+
if(recorder && recorderTimeoutID) {
333345
recorder.stop();
346+
334347
}
335348

336349
app.currentSession.stop({});

samples/webrtc/styles.css

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ b {
485485
}
486486

487487
.caller__ctrl{
488-
height: 100px;
488+
height: 90px;
489489
}
490490

491491
.caller__ctrl_btn {
@@ -523,6 +523,9 @@ b {
523523
background: #ff2d55;
524524
color: #fff;
525525
}
526+
.caller__ctrl_btn:last-child {
527+
margin-bottom: 0;
528+
}
526529

527530
.caller__name {
528531
margin: 20px 0 0 0;
@@ -586,7 +589,7 @@ b {
586589
}
587590

588591
.caller__frames_fl {
589-
margin: 30px 0 10px 0;
592+
margin: 15px 0 10px 0;
590593
}
591594

592595
/**
@@ -684,3 +687,10 @@ b {
684687
font-size: 15px;
685688
line-height: 1.2;
686689
}
690+
691+
.sample_info {
692+
margin: 5px 0 0 0;
693+
font-size: 12px;
694+
line-height: 1.4;
695+
color: #808080;
696+
}

0 commit comments

Comments
 (0)