Skip to content

Commit 825c782

Browse files
committed
Updated the QBMediaRecorder in the WebRTC Sample
1 parent aaf606d commit 825c782

File tree

4 files changed

+25
-27
lines changed

4 files changed

+25
-27
lines changed

quickblox.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/webrtc/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ <h4 class="caller__name">
362362
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
363363

364364
<!-- Check our qbMediaRecorder https://github.com/QuickBlox/javascript-media-recorder -->
365-
<script src="https://unpkg.com/media-recorder-js@0.1.0/mediaRecorder.js"></script>
365+
<script src="https://unpkg.com/media-recorder-js@2.0.0/qbMediaRecorder.js"></script>
366366

367367
<!-- QB -->
368368
<script src="../../quickblox.min.js"></script>

samples/webrtc/js/app.js

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,24 @@
1111
var recorder = null;
1212

1313
var recorderOpts = {
14-
callbacks: {
15-
onStart: function onStartRecord() {
16-
console.log('[QB Recorder] onStartRecording');
17-
$('.j-record').addClass('active');
18-
},
19-
onStop: function(blob) {
20-
console.log('[QB Recorder] onStopRecording');
21-
$('.j-record').removeClass('active');
22-
23-
var down = confirm('Do you want to download video?');
24-
25-
if (down) {
26-
recorder.download('QB_WEBrtc_sample' + Date.now(), blob);
27-
}
28-
29-
recorder = null;
30-
},
31-
onError: function(error) {
32-
console.error('Recorder error', error);
14+
onstart: function onStartRecord() {
15+
console.log('[QB Recorder] onStartRecording');
16+
$('.j-record').addClass('active');
17+
},
18+
onstop: function(blob) {
19+
console.log('[QB Recorder] onStopRecording');
20+
$('.j-record').removeClass('active');
21+
22+
var down = confirm('Do you want to download video?');
23+
24+
if (down) {
25+
recorder.download('QB_WEBrtc_sample' + Date.now(), blob);
3326
}
27+
28+
recorder = null;
29+
},
30+
onerror: function(error) {
31+
console.error('Recorder error', error);
3432
}
3533
};
3634
var isAudio = false;
@@ -164,8 +162,8 @@
164162
var framesTpl = _.template( $('#frames_tpl').html() );
165163
$('.j-board').append( framesTpl({'nameUser': app.caller.full_name}));
166164

167-
// TODO: Hide a record button if browser not supported it
168-
if (!qbMediaRecorder.isAvailable()) {
165+
// Hide a record button if browser not supported it
166+
if (!QBMediaRecorder.isAvailable()) {
169167
$('.j-record').hide();
170168
}
171169

@@ -622,7 +620,7 @@
622620

623621
if(_.isEmpty(app.currentSession)) {
624622
return false;
625-
} else if(qbMediaRecorder.isAvailable()) {
623+
} else if(QBMediaRecorder.isAvailable()) {
626624
if(!isActive){
627625
var connections = app.currentSession.peerConnections,
628626
connection = connections[app.mainVideo],
@@ -632,8 +630,8 @@
632630
return false;
633631
}
634632

635-
recorder = new qbMediaRecorder(connection.stream, recorderOpts);
636-
recorder.start();
633+
recorder = new QBMediaRecorder(recorderOpts);
634+
recorder.start(connection.stream);
637635
} else {
638636
recorder.stop();
639637
}

src/qbConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
var config = {
1515
version: '2.8.0',
16-
buildNumber: '1060',
16+
buildNumber: '1061',
1717
creds: {
1818
appId: '',
1919
authKey: '',

0 commit comments

Comments
 (0)