Skip to content

Commit 0ecec90

Browse files
committed
Added [email protected] May fixed #127
1 parent 4e6839c commit 0ecec90

File tree

10 files changed

+250
-67
lines changed

10 files changed

+250
-67
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ node_js:
33
- "0.11"
44
install: npm install
55
before_script:
6-
- npm install grunt-cli
7-
- npm install grunt
6+
- npm install grunt-cli@0.1.13 -g
7+
- npm install grunt@0.4.5
88
- grunt
9+
after_failure: npm install && grunt
910
matrix:
1011
fast_finish: true
12+

Gruntfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = function(grunt) {
2626
'dev/RecordRTC-Configuration.js',
2727
'dev/GetRecorderType.js',
2828
'dev/MRecordRTC.js',
29+
'dev/amd.js',
2930
'dev/Cross-Browser-Declarations.js',
3031
'dev/Storage.js',
3132
'dev/isMediaRecorderCompatible.js',

README.md

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -61,60 +61,83 @@ You can also try a chrome extension for screen recording:
6161

6262
* https://chrome.google.com/webstore/detail/recordrtc/ndcljioonkecdnaaihodjgiliohngojp
6363

64-
## How to link?
64+
# How to link?
65+
66+
## [NPM](https://www.npmjs.com/package/recordrtc) install
6567

6668
```
6769
npm install recordrtc
6870
6971
# you can use with "require" (browserify/nodejs)
7072
var RecordRTC = require('recordrtc');
71-
var recorder = RecordRTC(mediaStream, { type: 'audio'});
72-
```
7373
74-
or using [Bower](http://bower.io):
74+
var recorder = RecordRTC({}, {
75+
type: 'video',
76+
recorderType: RecordRTC.WhammyRecorder
77+
});
78+
79+
console.log('\n--------\nRecordRTC\n--------\n');
80+
console.log(recorder);
7581
76-
```
77-
bower install recordrtc
82+
console.log('\n--------\nstartRecording\n--------\n');
83+
recorder.startRecording();
84+
console.log('\n--------\nprocess.exit()\n--------\n');
85+
86+
process.exit()
7887
```
7988

80-
To use it:
89+
* https://tonicdev.com/npm/recordrtc
8190

82-
```html
83-
<script src="./node_modules/recordrtc/RecordRTC.js"></script>
91+
Here is how to use `require`:
8492

85-
<!-- or -->
86-
<script src="https://cdn.WebRTC-Experiment.com/RecordRTC.js"></script>
93+
```javascript
94+
var RecordRTC = require('recordrtc');
95+
var Whammy = RecordRTC.Whammy;
96+
var WhammyRecorder = RecordRTC.WhammyRecorder;
97+
var StereoAudioRecorder = RecordRTC.StereoAudioRecorder;
98+
// and so on
8799

88-
<!-- or -->
89-
<script src="https://www.WebRTC-Experiment.com/RecordRTC.js"></script>
100+
var video = new Whammy.Video(100);
101+
var recorder = new StereoAudioRecorder(stream, options);
90102
```
91103

92-
It is suggested to link specific release:
104+
```html
105+
<!-- link npm package scripts -->
106+
<script src="./node_modules/recordrtc/RecordRTC.js"></script>
107+
```
93108

94-
* https://github.com/muaz-khan/RecordRTC/releases
109+
There are some other NPM packages regarding RecordRTC:
110+
111+
* [https://www.npmjs.org/search?q=RecordRTC](https://www.npmjs.org/search?q=RecordRTC)
95112

96-
E.g.
113+
## [bower](http://bower.io) install
114+
115+
```
116+
bower install recordrtc
117+
```
97118

98119
```html
99-
<!-- use 5.2.6 or any other version -->
100-
<script src="https://github.com/muaz-khan/RecordRTC/releases/download/5.3.3/RecordRTC.js"></script>
120+
<!-- link bower package scripts -->
121+
<script src="./bower_components/recordrtc/RecordRTC.js"></script>
101122
```
102123

103-
There are some other NPM packages regarding RecordRTC:
124+
## CDN
104125

105-
* [https://www.npmjs.org/search?q=RecordRTC](https://www.npmjs.org/search?q=RecordRTC)
126+
```html
127+
<!-- CDN -->
128+
<script src="https://cdn.WebRTC-Experiment.com/RecordRTC.js"></script>
106129

107-
Here is how to use `require`:
130+
<!-- non-CDN -->
131+
<script src="https://www.WebRTC-Experiment.com/RecordRTC.js"></script>
132+
```
108133

109-
```javascript
110-
var RecordRTC = require('recordrtc');
111-
var Whammy = RecordRTC.Whammy;
112-
var WhammyRecorder = RecordRTC.WhammyRecorder;
113-
var StereoAudioRecorder = RecordRTC.StereoAudioRecorder;
114-
// and so on
134+
## Releases
115135

116-
var video = new Whammy.Video(100);
117-
var recorder = new StereoAudioRecorder(stream, options);
136+
You can even link specific [releases](https://github.com/muaz-khan/RecordRTC/releases):
137+
138+
```html
139+
<!-- use 5.3.5 or any other version -->
140+
<script src="https://github.com/muaz-khan/RecordRTC/releases/download/5.3.5/RecordRTC.js"></script>
118141
```
119142

120143
## How to capture stream?

RecordRTC.js

Lines changed: 85 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
// Last time updated: 2016-05-03 8:19:31 AM UTC
3+
// Last time updated: 2016-05-06 5:21:33 PM UTC
44

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

@@ -1167,21 +1167,95 @@ if (typeof RecordRTC !== 'undefined') {
11671167
RecordRTC.MRecordRTC = MRecordRTC;
11681168
}
11691169

1170-
// _____________________________
1171-
// Cross-Browser-Declarations.js
1170+
var browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';
11721171

1173-
// animation-frame used in WebM recording
1172+
(function(that) {
1173+
if (!that) {
1174+
return;
1175+
}
1176+
1177+
if (typeof window !== 'undefined') {
1178+
return;
1179+
}
1180+
1181+
if (typeof global === 'undefined') {
1182+
return;
1183+
}
11741184

1175-
if (typeof window === 'undefined' && typeof global !== 'undefined') {
11761185
global.navigator = {
1177-
userAgent: ''
1186+
userAgent: browserFakeUserAgent,
1187+
getUserMedia: function() {}
11781188
};
11791189

1190+
if (!global.console) {
1191+
global.console = {};
1192+
}
1193+
1194+
if (typeof global.console.debug === 'undefined') {
1195+
global.console.debug = global.console.info = global.console.error = global.console.log = global.console.log || function() {
1196+
console.log(arguments);
1197+
};
1198+
}
1199+
1200+
if (typeof document === 'undefined') {
1201+
/*global document:true */
1202+
that.document = {};
1203+
1204+
document.createElement = document.captureStream = document.mozCaptureStream = function() {
1205+
var obj = {
1206+
getContext: function() {
1207+
return obj;
1208+
},
1209+
play: function() {},
1210+
pause: function() {},
1211+
drawImage: function() {},
1212+
toDataURL: function() {
1213+
return '';
1214+
}
1215+
};
1216+
return obj;
1217+
};
1218+
1219+
that.HTMLVideoElement = function() {};
1220+
}
1221+
1222+
if (typeof location === 'undefined') {
1223+
/*global location:true */
1224+
that.location = {
1225+
protocol: 'file:',
1226+
href: '',
1227+
hash: ''
1228+
};
1229+
}
1230+
1231+
if (typeof screen === 'undefined') {
1232+
/*global screen:true */
1233+
that.screen = {
1234+
width: 0,
1235+
height: 0
1236+
};
1237+
}
1238+
1239+
if (typeof URL === 'undefined') {
1240+
/*global screen:true */
1241+
that.URL = {
1242+
createObjectURL: function() {
1243+
return '';
1244+
},
1245+
revokeObjectURL: function() {
1246+
return '';
1247+
}
1248+
};
1249+
}
1250+
11801251
/*global window:true */
1181-
var window = global;
1182-
} else if (typeof window === 'undefined') {
1183-
// window = this;
1184-
}
1252+
that.window = global;
1253+
})(typeof global !== 'undefined' ? global : null);
1254+
1255+
// _____________________________
1256+
// Cross-Browser-Declarations.js
1257+
1258+
// animation-frame used in WebM recording
11851259

11861260
/*jshint -W079 */
11871261
var requestAnimationFrame = window.requestAnimationFrame;
@@ -1234,18 +1308,14 @@ if (typeof URL === 'undefined' && typeof webkitURL !== 'undefined') {
12341308
URL = webkitURL;
12351309
}
12361310

1237-
if (typeof navigator !== 'undefined') {
1311+
if (typeof navigator !== 'undefined') { // maybe window.navigator?
12381312
if (typeof navigator.webkitGetUserMedia !== 'undefined') {
12391313
navigator.getUserMedia = navigator.webkitGetUserMedia;
12401314
}
12411315

12421316
if (typeof navigator.mozGetUserMedia !== 'undefined') {
12431317
navigator.getUserMedia = navigator.mozGetUserMedia;
12441318
}
1245-
} else {
1246-
// if you're using NPM or solutions where "navigator" is NOT available,
1247-
// just define it globally before loading RecordRTC.js script.
1248-
throw 'Please make sure to define a global variable named as "navigator"';
12491319
}
12501320

12511321
var isEdge = navigator.userAgent.indexOf('Edge') !== -1 && (!!navigator.msSaveBlob || !!navigator.msSaveOrOpenBlob);

RecordRTC.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "recordrtc",
3-
"version": "5.3.4",
3+
"version": "5.3.5",
44
"authors": [
55
{
66
"name": "Muaz Khan",
@@ -13,7 +13,7 @@
1313
"type": "git",
1414
"url": "https://github.com/muaz-khan/RecordRTC.git"
1515
},
16-
"description": "RecordRTC is a server-less (entire client-side) JavaScript library can be used to record WebRTC audio/video media streams. It supports cross-browser audio/video recording.",
16+
"description": "RecordRTC is a JavaScript library can be used to record WebRTC audio/video media streams.",
1717
"main": "RecordRTC.js",
1818
"keywords": [
1919
"webrtc",

dev/Cross-Browser-Declarations.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@
33

44
// animation-frame used in WebM recording
55

6-
if (typeof window === 'undefined' && typeof global !== 'undefined') {
7-
global.navigator = {
8-
userAgent: ''
9-
};
10-
11-
/*global window:true */
12-
var window = global;
13-
} else if (typeof window === 'undefined') {
14-
// window = this;
15-
}
16-
176
/*jshint -W079 */
187
var requestAnimationFrame = window.requestAnimationFrame;
198
if (typeof requestAnimationFrame === 'undefined') {
@@ -65,18 +54,14 @@ if (typeof URL === 'undefined' && typeof webkitURL !== 'undefined') {
6554
URL = webkitURL;
6655
}
6756

68-
if (typeof navigator !== 'undefined') {
57+
if (typeof navigator !== 'undefined') { // maybe window.navigator?
6958
if (typeof navigator.webkitGetUserMedia !== 'undefined') {
7059
navigator.getUserMedia = navigator.webkitGetUserMedia;
7160
}
7261

7362
if (typeof navigator.mozGetUserMedia !== 'undefined') {
7463
navigator.getUserMedia = navigator.mozGetUserMedia;
7564
}
76-
} else {
77-
// if you're using NPM or solutions where "navigator" is NOT available,
78-
// just define it globally before loading RecordRTC.js script.
79-
throw 'Please make sure to define a global variable named as "navigator"';
8065
}
8166

8267
var isEdge = navigator.userAgent.indexOf('Edge') !== -1 && (!!navigator.msSaveBlob || !!navigator.msSaveOrOpenBlob);

0 commit comments

Comments
 (0)