Skip to content

Commit

Permalink
Added recordrtc@5.3.2 Fixed #117 and Fixed #118
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Apr 15, 2016
1 parent f86b78a commit 5479366
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -91,7 +91,7 @@ E.g.

```html
<!-- use 5.2.6 or any other version -->
<script src="https://github.com/muaz-khan/RecordRTC/releases/download/5.3.1/RecordRTC.js"></script>
<script src="https://github.com/muaz-khan/RecordRTC/releases/download/5.3.2/RecordRTC.js"></script>
```

There are some other NPM packages regarding RecordRTC:
Expand Down
53 changes: 27 additions & 26 deletions RecordRTC.js
@@ -1,6 +1,6 @@
'use strict';

// Last time updated: 2016-04-15 3:24:52 PM UTC
// Last time updated: 2016-04-15 4:24:45 PM UTC

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

Expand Down Expand Up @@ -170,7 +170,7 @@ function RecordRTC(mediaStream, config) {
throw 'Pass a callback function over getDataURL.';
}

var blob = _mediaRecorder ? _mediaRecorder.blob : mediaRecorder.blob;
var blob = _mediaRecorder ? _mediaRecorder.blob : (mediaRecorder || {}).blob;

if (!blob) {
if (!config.disableLogs) {
Expand Down Expand Up @@ -845,16 +845,26 @@ function MRecordRTC(mediaStream) {
gif: null
};

if (typeof mediaType.audio !== 'function' && isMediaRecorderCompatible() && mediaStream && mediaStream.getAudioTracks && mediaStream.getAudioTracks().length && mediaStream.getVideoTracks().length) {
if (typeof mediaType.audio !== 'function' && isMediaRecorderCompatible() && mediaStream.getAudioTracks && !mediaStream.getAudioTracks().length) {
// Firefox is supporting both audio/video in single blob
this.mediaType.audio = false;
mediaType.audio = false;
}

if (typeof mediaType.video !== 'function' && isMediaRecorderCompatible() && mediaStream.getVideoTracks && !mediaStream.getVideoTracks().length) {
// Firefox is supporting both audio/video in single blob
mediaType.video = false;
}

if (!mediaType.audio && !mediaType.video) {
throw 'MediaStream must have either audio or video tracks.';
}

if (!!mediaType.audio) {
recorderType = null;
if (typeof mediaType.audio === 'function') {
recorderType = mediaType.audio;
}

this.audioRecorder = new RecordRTC(mediaStream, {
type: 'audio',
bufferSize: this.bufferSize,
Expand All @@ -864,6 +874,7 @@ function MRecordRTC(mediaStream) {
recorderType: recorderType,
mimeType: mimeType.audio
});

if (!mediaType.video) {
this.audioRecorder.startRecording();
}
Expand Down Expand Up @@ -902,20 +913,26 @@ function MRecordRTC(mediaStream) {
recorderType: recorderType,
mimeType: mimeType.video
});

if (!mediaType.audio) {
this.videoRecorder.startRecording();
}
}

if (!!mediaType.audio && !!mediaType.video) {
var self = this;
self.videoRecorder.initRecorder(function() {
self.audioRecorder.initRecorder(function() {
// Both recorders are ready to record things accurately
self.videoRecorder.startRecording();
self.audioRecorder.startRecording();
if (isMediaRecorderCompatible()) {
self.audioRecorder = null;
self.videoRecorder.startRecording();
} else {
self.videoRecorder.initRecorder(function() {
self.audioRecorder.initRecorder(function() {
// Both recorders are ready to record things accurately
self.videoRecorder.startRecording();
self.audioRecorder.startRecording();
});
});
});
}
}

if (!!mediaType.gif) {
Expand Down Expand Up @@ -3408,22 +3425,6 @@ var DiskStorage = {
return;
}

if (typeof webkitIndexedDB !== 'undefined') {
indexedDB = webkitIndexedDB;
}

if (typeof mozIndexedDB !== 'undefined') {
indexedDB = mozIndexedDB;
}

if (typeof OIndexedDB !== 'undefined') {
indexedDB = OIndexedDB;
}

if (typeof msIndexedDB !== 'undefined') {
indexedDB = msIndexedDB;
}

var dbVersion = 1;
var dbName = this.dbName || location.href.replace(/\/|:|#|%|\.|\[|\]/g, ''),
db;
Expand Down
6 changes: 3 additions & 3 deletions RecordRTC.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "recordrtc",
"version": "5.3.1",
"version": "5.3.2",
"authors": [
{
"name": "Muaz Khan",
Expand Down
16 changes: 0 additions & 16 deletions dev/DiskStorage.js
Expand Up @@ -45,22 +45,6 @@ var DiskStorage = {
return;
}

if (typeof webkitIndexedDB !== 'undefined') {
indexedDB = webkitIndexedDB;
}

if (typeof mozIndexedDB !== 'undefined') {
indexedDB = mozIndexedDB;
}

if (typeof OIndexedDB !== 'undefined') {
indexedDB = OIndexedDB;
}

if (typeof msIndexedDB !== 'undefined') {
indexedDB = msIndexedDB;
}

var dbVersion = 1;
var dbName = this.dbName || location.href.replace(/\/|:|#|%|\.|\[|\]/g, ''),
db;
Expand Down
33 changes: 25 additions & 8 deletions dev/MRecordRTC.js
Expand Up @@ -77,16 +77,26 @@ function MRecordRTC(mediaStream) {
gif: null
};

if (typeof mediaType.audio !== 'function' && isMediaRecorderCompatible() && mediaStream && mediaStream.getAudioTracks && mediaStream.getAudioTracks().length && mediaStream.getVideoTracks().length) {
if (typeof mediaType.audio !== 'function' && isMediaRecorderCompatible() && mediaStream.getAudioTracks && !mediaStream.getAudioTracks().length) {
// Firefox is supporting both audio/video in single blob
this.mediaType.audio = false;
mediaType.audio = false;
}

if (typeof mediaType.video !== 'function' && isMediaRecorderCompatible() && mediaStream.getVideoTracks && !mediaStream.getVideoTracks().length) {
// Firefox is supporting both audio/video in single blob
mediaType.video = false;
}

if (!mediaType.audio && !mediaType.video) {
throw 'MediaStream must have either audio or video tracks.';
}

if (!!mediaType.audio) {
recorderType = null;
if (typeof mediaType.audio === 'function') {
recorderType = mediaType.audio;
}

this.audioRecorder = new RecordRTC(mediaStream, {
type: 'audio',
bufferSize: this.bufferSize,
Expand All @@ -96,6 +106,7 @@ function MRecordRTC(mediaStream) {
recorderType: recorderType,
mimeType: mimeType.audio
});

if (!mediaType.video) {
this.audioRecorder.startRecording();
}
Expand Down Expand Up @@ -134,20 +145,26 @@ function MRecordRTC(mediaStream) {
recorderType: recorderType,
mimeType: mimeType.video
});

if (!mediaType.audio) {
this.videoRecorder.startRecording();
}
}

if (!!mediaType.audio && !!mediaType.video) {
var self = this;
self.videoRecorder.initRecorder(function() {
self.audioRecorder.initRecorder(function() {
// Both recorders are ready to record things accurately
self.videoRecorder.startRecording();
self.audioRecorder.startRecording();
if (isMediaRecorderCompatible()) {
self.audioRecorder = null;
self.videoRecorder.startRecording();
} else {
self.videoRecorder.initRecorder(function() {
self.audioRecorder.initRecorder(function() {
// Both recorders are ready to record things accurately
self.videoRecorder.startRecording();
self.audioRecorder.startRecording();
});
});
});
}
}

if (!!mediaType.gif) {
Expand Down
2 changes: 1 addition & 1 deletion dev/RecordRTC.js
Expand Up @@ -159,7 +159,7 @@ function RecordRTC(mediaStream, config) {
throw 'Pass a callback function over getDataURL.';
}

var blob = _mediaRecorder ? _mediaRecorder.blob : mediaRecorder.blob;
var blob = _mediaRecorder ? _mediaRecorder.blob : (mediaRecorder || {}).blob;

if (!blob) {
if (!config.disableLogs) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "recordrtc",
"preferGlobal": false,
"version": "5.3.1",
"version": "5.3.2",
"author": {
"name": "Muaz Khan",
"email": "muazkh@gmail.com",
Expand Down

0 comments on commit 5479366

Please sign in to comment.