Skip to content

Commit

Permalink
RecordRTC.js and RTCMultiConnection-v2.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Nov 11, 2014
1 parent 64fa451 commit 431f0e7
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 33 deletions.
4 changes: 2 additions & 2 deletions RTCMultiConnection/Library/RTCMultiConnection-v2.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// Demos - www.WebRTC-Experiment.com/RTCMultiConnection

// _________________________
// RTCMultiConnection-v2.2.2
// RTCMultiConnection-v2.2.3

/* issues/features need to be fixed & implemented:
Expand Down Expand Up @@ -3467,7 +3467,7 @@ connection.rtcConfiguration
}

this.iceServers = {
iceServers: this.rtcConfiguration || this.iceServers,
iceServers: this.iceServers,
iceTransports: this.rtcConfiguration.iceTransports
};
} else this.iceServers = null;
Expand Down
2 changes: 1 addition & 1 deletion RTCMultiConnection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ There are some other NPM packages regarding RTCMultiConnection:

```
// latest file
https://cdn.webrtc-experiment.com/RTCMultiConnection-v2.2.2.js
https://cdn.webrtc-experiment.com/RTCMultiConnection-v2.2.3.js
// or a little bit more stable version: (v2.*.*)
https://cdn.webrtc-experiment.com/RTCMultiConnection.js
Expand Down
4 changes: 2 additions & 2 deletions RTCMultiConnection/latest.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// Demos - www.WebRTC-Experiment.com/RTCMultiConnection

// _________________________
// RTCMultiConnection-v2.2.2
// RTCMultiConnection-v2.2.3

/* issues/features need to be fixed & implemented:
Expand Down Expand Up @@ -3467,7 +3467,7 @@ connection.rtcConfiguration
}

this.iceServers = {
iceServers: this.rtcConfiguration || this.iceServers,
iceServers: this.iceServers,
iceTransports: this.rtcConfiguration.iceTransports
};
} else this.iceServers = null;
Expand Down
2 changes: 1 addition & 1 deletion RTCMultiConnection/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rtcmulticonnection",
"preferGlobal": true,
"version": "2.2.2",
"version": "2.2.3",
"author": {
"name": "Muaz Khan",
"email": "[email protected]",
Expand Down
59 changes: 33 additions & 26 deletions RecordRTC/RecordRTC.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Last time updated at Nov 04, 2014, 08:32:23
// Last time updated at Nov 11, 2014, 08:32:23

// links:
// Open-Sourced: https://github.com/muaz-khan/RecordRTC
Expand All @@ -10,6 +10,7 @@

// updates?
/*
-. Fixed MRecordRTC.
-. Added functionality for analyse black frames and cut them - pull#293
-. if you're recording GIF, you must link: https://cdn.webrtc-experiment.com/gif-recorder.js
*/
Expand Down Expand Up @@ -212,6 +213,7 @@ function RecordRTC(mediaStream, config) {
* @example
* recordRTC.stopRecording(function(videoURL) {
* video.src = videoURL;
* recordRTC.blob; recordRTC.buffer;
* });
* @todo Implement <code class="str">recordRTC.stopRecording().getDataURL(callback);</code>
*/
Expand Down Expand Up @@ -242,11 +244,6 @@ function RecordRTC(mediaStream, config) {
* @memberof RecordRTC
* @instance
* @example
* recordRTC.getDataURL(function(dataURL) {
* video.src = dataURL;
* });
*
* // or
* recordRTC.stopRecording(function() {
* recordRTC.getDataURL(function(dataURL) {
* video.src = dataURL;
Expand Down Expand Up @@ -311,10 +308,8 @@ function RecordRTC(mediaStream, config) {
* @memberof RecordRTC
* @instance
* @example
* recordRTC.stopRecording(function() {
* recordRTC.getFromDisk(function(dataURL) {
* video.src = dataURL;
* });
* recordRTC.getFromDisk(function(dataURL) {
* video.src = dataURL;
* });
*/
getFromDisk: function(callback) {
Expand Down Expand Up @@ -586,27 +581,36 @@ function MRecordRTC(mediaStream) {
* recorder.startRecording();
*/
this.startRecording = function() {
if (!IsChrome && mediaStream && mediaStream.getAudioTracks().length && mediaStream.getVideoTracks().length) {
if (!IsChrome && mediaStream && mediaStream.getAudioTracks && mediaStream.getAudioTracks().length && mediaStream.getVideoTracks().length) {
// Firefox is supporting both audio/video in single blob
this.mediaType.audio = false;
}

if (this.mediaType.audio) {
this.audioRecorder = RecordRTC(mediaStream, this).startRecording();
this.audioRecorder = RecordRTC(mediaStream, {
type: 'audio',
bufferSize: this.bufferSize,
sampleRate: this.sampleRate
});
this.audioRecorder.startRecording();
}

if (this.mediaType.video) {
this.videoRecorder = RecordRTC(mediaStream, {
type: 'video'
}).startRecording();
type: 'video',
video: this.video,
canvas: this.canvas
});
this.videoRecorder.startRecording();
}

if (this.mediaType.gif) {
this.gifRecorder = RecordRTC(mediaStream, {
type: 'gif',
frameRate: this.frameRate || 200,
quality: this.quality || 10
}).startRecording();
});
this.gifRecorder.startRecording();
}
};

Expand Down Expand Up @@ -1251,6 +1255,9 @@ function StereoAudioRecorder(mediaStream, config) {
*/
this.view = view;

this.sampleRate = sampleRate;
this.bufferSize = bufferSize;

// recorded audio length
this.length = recordingLength;

Expand Down Expand Up @@ -1327,6 +1334,7 @@ function StereoAudioRecorder(mediaStream, config) {
* });
*/

// "0" means, let chrome decide the most accurate buffer-size for current platform.
var bufferSize = config.bufferSize || 4096;

if (legalBufferValues.indexOf(bufferSize) == -1) {
Expand Down Expand Up @@ -1358,12 +1366,6 @@ function StereoAudioRecorder(mediaStream, config) {
// throw 'sample-rate must be under range 22050 and 96000.';
}

this.sampleRate = sampleRate;
this.bufferSize = bufferSize;

console.log('sample-rate', sampleRate);
console.log('buffer-size', bufferSize);

if (context.createJavaScriptNode) {
__stereoAudioRecorderJavacriptNode = context.createJavaScriptNode(bufferSize, 2, 2);
} else if (context.createScriptProcessor) {
Expand All @@ -1372,6 +1374,11 @@ function StereoAudioRecorder(mediaStream, config) {
throw 'WebAudio API has no support on this browser.';
}

bufferSize = __stereoAudioRecorderJavacriptNode.bufferSize;

console.log('sample-rate', sampleRate);
console.log('buffer-size', bufferSize);

var isAudioProcessStarted = false,
self = this;
__stereoAudioRecorderJavacriptNode.onaudioprocess = function(e) {
Expand Down Expand Up @@ -1576,11 +1583,6 @@ function WhammyRecorder(mediaStream) {

var frames = [];

// if user want to display advertisement before recorded video!
if (this.advertisement) {
frames = advertisement;
}

function drawFrames() {
var duration = new Date().getTime() - lastTime;
if (!duration) return drawFrames();
Expand Down Expand Up @@ -1704,6 +1706,11 @@ function WhammyRecorder(mediaStream) {
// e.g. dropBlackFrames(frames, 10, 0.5, 0.5) - will analyse 10 frames
// e.g. dropBlackFrames(frames, 10) == dropBlackFrames(frames, 10, 0, 0) - will analyse 10 frames with strict black color
whammy.frames = dropBlackFrames(frames, -1);

// to display advertisement images!
if (this.advertisement && this.advertisement.length) {
whammy.frames = advertisement.concat(whammy.frames);
}

/**
* @property {Blob} blob - Recorded frames in video/webm blob.
Expand Down
2 changes: 1 addition & 1 deletion RecordRTC/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "recordrtc",
"preferGlobal": false,
"version": "4.0.9",
"version": "5.0.1",
"author": {
"name": "Muaz Khan",
"email": "[email protected]",
Expand Down

0 comments on commit 431f0e7

Please sign in to comment.