Skip to content

Commit

Permalink
Tinny fixes in the MediaStreamRecorder.js (Firefox-on-Android)
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Jun 24, 2016
1 parent 7c49d6f commit 903c4c3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

> [RecordRTC](https://www.webrtc-experiment.com/RecordRTC/) is a JavaScript-based media-recording library for modern web-browsers (supporting WebRTC getUserMedia API). It is optimized for different devices and browsers to bring all client-side (pluginfree) recording solutions in single place.
* [Youtube Video Tutorial](https://www.youtube.com/watch?v=YrLzTgdJ-Kg)
<a href="https://www.youtube.com/watch?v=YrLzTgdJ-Kg"><img src="https://cdn.webrtc-experiment.com/images/RecordRTC-YouTube.png" alt="YouTube Video Tutorial for RecordRTC!" /></a>

# Check all releases:

Expand Down
17 changes: 14 additions & 3 deletions RecordRTC.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

// Last time updated: 2016-06-17 9:27:11 AM UTC
// Last time updated: 2016-06-24 7:36:34 PM UTC

// Open-Sourced: https://github.com/muaz-khan/RecordRTC

Expand Down Expand Up @@ -1676,7 +1676,12 @@ function MediaStreamRecorder(mediaStream, config) {

// starting a recording session; which will initiate "Reading Thread"
// "Reading Thread" are used to prevent main-thread blocking scenarios
mediaRecorder = new MediaRecorder(mediaStream, recorderHints);
try {
mediaRecorder = new MediaRecorder(mediaStream, recorderHints);
}
catch(e) {
mediaRecorder = new MediaRecorder(mediaStream);
}

if ('canRecordMimeType' in mediaRecorder && mediaRecorder.canRecordMimeType(config.mimeType) === false) {
if (!config.disableLogs) {
Expand Down Expand Up @@ -1779,7 +1784,13 @@ function MediaStreamRecorder(mediaStream, config) {
return;
}

this.recordingCallback = callback || function() {};
this.recordingCallback = function(blob) {
mediaRecorder = null;

if(callback) {
callback(blob);
}
};

// mediaRecorder.state === 'recording' means that media recorder is associated with "session"
// mediaRecorder.state === 'stopped' means that media recorder is detached from the "session" ... in this case; "session" will also be deleted.
Expand Down
6 changes: 3 additions & 3 deletions RecordRTC.min.js

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions dev/MediaStreamRecorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ function MediaStreamRecorder(mediaStream, config) {

// starting a recording session; which will initiate "Reading Thread"
// "Reading Thread" are used to prevent main-thread blocking scenarios
mediaRecorder = new MediaRecorder(mediaStream, recorderHints);
try {
mediaRecorder = new MediaRecorder(mediaStream, recorderHints);
} catch (e) {
mediaRecorder = new MediaRecorder(mediaStream);
}

if ('canRecordMimeType' in mediaRecorder && mediaRecorder.canRecordMimeType(config.mimeType) === false) {
if (!config.disableLogs) {
Expand Down Expand Up @@ -204,7 +208,13 @@ function MediaStreamRecorder(mediaStream, config) {
return;
}

this.recordingCallback = callback || function() {};
this.recordingCallback = function(blob) {
mediaRecorder = null;

if (callback) {
callback(blob);
}
};

// mediaRecorder.state === 'recording' means that media recorder is associated with "session"
// mediaRecorder.state === 'stopped' means that media recorder is detached from the "session" ... in this case; "session" will also be deleted.
Expand Down

0 comments on commit 903c4c3

Please sign in to comment.