Skip to content

Commit 88e5de5

Browse files
committed
Merge pull request #42 from muaz-khan/experimental
Merge RecordRTC Experimental Branch
2 parents 0a266f4 + ea2d3b0 commit 88e5de5

25 files changed

+3797
-337
lines changed

Canvas-Recording/index.html

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,24 +94,33 @@ <h3>Content is edit-able.</h3>
9494
<br />
9595

9696
<pre>
97-
var recorder = RecordRTC(document.documentElement, { type: 'canvas' }); recorder.startRecording(); recorder.stopRecording(function(url) { window.open(url); });
98-
</pre>
97+
var recorder = RecordRTC(document.documentElement, {
98+
type: 'canvas'
99+
});
100+
recorder.startRecording();
101+
recorder.stopRecording(function(url) {
102+
window.open(url);
103+
});
104+
</pre>
99105
</div>
100106

101107
<div style="position: fixed;left: 20%;right: 20%;text-align: center;">
102108
<button id="start" contenteditable="false">Start Canvas Recording</button>
103109
<button id="stop" disabled contenteditable="false">Stop</button>
104110
</div>
105111

106-
<script src="https://4dbefa02675a4cdb7fc25d009516b060a84a3b4b.googledrive.com/host/0B6GWd_dUUTT8WjhzNlloZmZtdzA/screenshot.js">
107-
</script>
108-
<script src="https://cdn.webrtc-experiment.com/RecordRTC.js">
109-
</script>
112+
<script src="https://4dbefa02675a4cdb7fc25d009516b060a84a3b4b.googledrive.com/host/0B6GWd_dUUTT8WjhzNlloZmZtdzA/screenshot.js"></script>
113+
<script src="https://cdn.webrtc-experiment.com/RecordRTC.js"></script>
114+
115+
<!--
116+
<script src="/libs/screenshot-dev.js"></script>
117+
<script src="/RecordRTC.js"></script>
118+
-->
110119

111120
<script>
112121
var elementToShare = document.getElementById('elementToShare');
113122
var recorder = RecordRTC(elementToShare, {
114-
type: 'canvas'
123+
recorderType: CanvasRecorder
115124
});
116125

117126
document.getElementById('start').onclick = function() {
@@ -133,5 +142,10 @@ <h3>Content is edit-able.</h3>
133142
video.play();
134143
});
135144
};
145+
146+
window.onbeforeunload = function() {
147+
document.getElementById('start').disabled = false;
148+
document.getElementById('stop').disabled = true;
149+
};
136150
</script>
137151
<a href="https://www.webrtc-experiment.com/" style="border-bottom: 1px solid red; color: red; font-size: 1.2em; position: absolute; right: 0; text-decoration: none; top: 0;">←WebRTC Experiments Homepage</a>

Gruntfile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module.exports = function(grunt) {
2020
src: [
2121
'dev/head.js',
2222
'dev/RecordRTC.js',
23+
'dev/RecordRTC-Configuration.js',
24+
'dev/GetRecorderType.js',
2325
'dev/MRecordRTC.js',
2426
'dev/Cross-Browser-Declarations.js',
2527
'dev/Storage.js',

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ var recordRTC;
117117
function successCallback(stream) {
118118
// RecordRTC usage goes here
119119

120+
var options = {
121+
mimeType: 'video/webm', // or video/mp4 or audio/ogg
122+
audioBitsPerSecond: 128000,
123+
videoBitsPerSecond: 128000,
124+
bitsPerSecond: 128000 // if this line is provided, skip above two
125+
};
120126
recordRTC = RecordRTC(MediaStream);
121127
recordRTC.startRecording();
122128
}
@@ -529,6 +535,58 @@ If you passed invalid value then you'll get blank audio.
529535

530536
You can pass custom sample-rate values only on Mac (or additionally maybe on Windows 10).
531537

538+
## `mimeType`
539+
540+
This option allows you set MediaRecorder output format (currently works only in Firefox; Chrome support coming soon):
541+
542+
```javascript
543+
var options = {
544+
mimeType 'video/webm', // or video/mp4 or audio/ogg
545+
bitsPerSecond: 128000
546+
};
547+
var recorder = RecordRTC(mediaStream, options);
548+
```
549+
550+
Note: For chrome, it will simply auto-set `type:audio or video` parameters to keep supporting `StereoAudioRecorder.js` and `WhammyRecorder.js`.
551+
552+
That is, you can skip passing `type:audio` parameter when you're using `mimeType` parameter.
553+
554+
## `bitsPerSecond`
555+
556+
The chosen bitrate for the audio and video components of the media. If this is specified along with one or the other of the above properties, this will be used for the one that isn't specified.
557+
558+
```javascript
559+
var options = {
560+
mimeType 'video/webm', // or video/mp4 or audio/ogg
561+
bitsPerSecond: 128000
562+
};
563+
var recorder = RecordRTC(mediaStream, options);
564+
```
565+
566+
## `audioBitsPerSecond`
567+
568+
The chosen bitrate for the audio component of the media.
569+
570+
```javascript
571+
var options = {
572+
mimeType 'audio/ogg',
573+
audioBitsPerSecond: 128000
574+
};
575+
var recorder = RecordRTC(mediaStream, options);
576+
```
577+
578+
## `videooBitsPerSecond`
579+
580+
The chosen bitrate for the video component of the media.
581+
582+
```javascript
583+
var options = {
584+
mimeType 'video/webm', // or video/mp4
585+
videooBitsPerSecond: 128000
586+
};
587+
var recorder = RecordRTC(mediaStream, options);
588+
```
589+
532590
## `onAudioProcessStarted`
533591

534592
Note: "initRecorder" is preferred over this old hack. Both works similarly.

RecordRTC-to-PHP/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ <h2 class="header">
194194
}
195195

196196
if(button.recordRTC) {
197-
if(button.recordRTC.length && button.RecordRTC instanceof Array) {
197+
if(button.recordRTC.length) {
198198
button.recordRTC[0].stopRecording(function(url) {
199199
if(!button.recordRTC[1]) {
200200
button.recordingEndedCallback(url);

0 commit comments

Comments
 (0)