code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function clearRecordedDataCB() {
arrayOfBlobs = [];
mediaRecorder = null;
self.timestamps = [];
} | This method resets currently recorded data.
@method
@memberof MediaStreamRecorder
@example
recorder.clearRecordedData(); | clearRecordedDataCB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function isMediaStreamActive() {
if ('active' in mediaStream) {
if (!mediaStream.active) {
return false;
}
} else if ('ended' in mediaStream) { // old hack
if (mediaStream.ended) {
return false;
}
}
return tr... | Access to native MediaRecorder API
@method
@memberof MediaStreamRecorder
@instance
@example
var internal = recorder.getInternalRecorder();
internal.ondataavailable = function() {}; // override
internal.stream, internal.onpause, internal.onstop, etc.
@returns {Object} Returns internal recording object. | isMediaStreamActive | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function isMediaStreamActive() {
if (config.checkForInactiveTracks === false) {
// always return "true"
return true;
}
if ('active' in mediaStream) {
if (!mediaStream.active) {
return false;
}
} else if ('ended' in mediaStr... | Set sample rates such as 8K or 16K. Reference: http://stackoverflow.com/a/28977136/552182
@property {number} desiredSampRate - Desired Bits per sample * 1000
@memberof StereoAudioRecorder
@instance
@example
var recorder = StereoAudioRecorder(mediaStream, {
desiredSampRate: 16 * 1000 // bits-per-sample * 1000
}); | isMediaStreamActive | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function mergeLeftRightBuffers(config, callback) {
function mergeAudioBuffers(config, cb) {
var numberOfAudioChannels = config.numberOfAudioChannels;
// todo: "slice(0)" --- is it causes loop? Should be removed?
var leftBuffers = config.leftBuffers.slice(0);
var ... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | mergeLeftRightBuffers | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function mergeAudioBuffers(config, cb) {
var numberOfAudioChannels = config.numberOfAudioChannels;
// todo: "slice(0)" --- is it causes loop? Should be removed?
var leftBuffers = config.leftBuffers.slice(0);
var rightBuffers = config.rightBuffers.slice(0);
va... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | mergeAudioBuffers | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function interpolateArray(data, newSampleRate, oldSampleRate) {
var fitCount = Math.round(data.length * (newSampleRate / oldSampleRate));
var newData = [];
var springFactor = Number((data.length - 1) / (fitCount - 1));
newData[0] = data[0];
... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | interpolateArray | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function linearInterpolate(before, after, atPoint) {
return before + (after - before) * atPoint;
} | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | linearInterpolate | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function mergeBuffers(channelBuffer, rLength) {
var result = new Float64Array(rLength);
var offset = 0;
var lng = channelBuffer.length;
for (var i = 0; i < lng; i++) {
var buffer = channelBuffer[i];
result.set(buffe... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | mergeBuffers | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function interleave(leftChannel, rightChannel) {
var length = leftChannel.length + rightChannel.length;
var result = new Float64Array(length);
var inputIndex = 0;
for (var index = 0; index < length;) {
result[index++] = leftChannel[i... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | interleave | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function writeUTFBytes(view, offset, string) {
var lng = string.length;
for (var i = 0; i < lng; i++) {
view.setUint8(offset + i, string.charCodeAt(i));
}
} | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | writeUTFBytes | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function processInWebWorker(_function) {
var workerURL = URL.createObjectURL(new Blob([_function.toString(),
';this.onmessage = function (eee) {' + _function.name + '(eee.data);}'
], {
type: 'application/javascript'
}));
var worker = new Worker(workerURL);
... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | processInWebWorker | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function resetVariables() {
leftchannel = [];
rightchannel = [];
recordingLength = 0;
isAudioProcessStarted = false;
recording = false;
isPaused = false;
context = null;
self.leftchannel = leftchannel;
self.rightchannel = rightchannel;
sel... | This method resets currently recorded data.
@method
@memberof StereoAudioRecorder
@example
recorder.clearRecordedData(); | resetVariables | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function clearRecordedDataCB() {
if (jsAudioNode) {
jsAudioNode.onaudioprocess = null;
jsAudioNode.disconnect();
jsAudioNode = null;
}
if (audioInput) {
audioInput.disconnect();
audioInput = null;
}
resetVariables();
... | This method resets currently recorded data.
@method
@memberof StereoAudioRecorder
@example
recorder.clearRecordedData(); | clearRecordedDataCB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function onAudioProcessDataAvailable(e) {
if (isPaused) {
return;
}
if (isMediaStreamActive() === false) {
if (!config.disableLogs) {
console.log('MediaStream seems stopped.');
}
jsAudioNode.disconnect();
recording = fa... | This method resets currently recorded data.
@method
@memberof StereoAudioRecorder
@example
recorder.clearRecordedData(); | onAudioProcessDataAvailable | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function looper() {
if (!recording || typeof config.ondataavailable !== 'function' || typeof config.timeSlice === 'undefined') {
return;
}
if (intervalsBasedBuffers.left.length) {
mergeLeftRightBuffers({
desiredSampRate: desiredSampRate,
s... | This method is called on "onaudioprocess" event's first invocation.
@method {function} onAudioProcessStarted
@memberof StereoAudioRecorder
@example
recorder.onAudioProcessStarted: function() { }; | looper | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function clearRecordedDataCB() {
whammy.frames = [];
isRecording = false;
isPausedRecording = false;
} | This method resets currently recorded data.
@method
@memberof CanvasRecorder
@example
recorder.clearRecordedData(); | clearRecordedDataCB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function cloneCanvas() {
//create a new canvas
var newCanvas = document.createElement('canvas');
var context = newCanvas.getContext('2d');
//set dimensions
newCanvas.width = htmlElement.width;
newCanvas.height = htmlElement.height;
//apply the old canvas to the ... | This method resets currently recorded data.
@method
@memberof CanvasRecorder
@example
recorder.clearRecordedData(); | cloneCanvas | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function drawCanvasFrame() {
if (isPausedRecording) {
lastTime = new Date().getTime();
return setTimeout(drawCanvasFrame, 500);
}
if (htmlElement.nodeName.toLowerCase() === 'canvas') {
var duration = new Date().getTime() - lastTime;
// via #206, b... | This method resets currently recorded data.
@method
@memberof CanvasRecorder
@example
recorder.clearRecordedData(); | drawCanvasFrame | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function drawFrames(frameInterval) {
frameInterval = typeof frameInterval !== 'undefined' ? frameInterval : 10;
var duration = new Date().getTime() - lastTime;
if (!duration) {
return setTimeout(drawFrames, frameInterval, frameInterval);
}
if (isPausedRecording) {
... | Draw and push frames to Whammy
@param {integer} frameInterval - set minimum interval (in milliseconds) between each time we push a frame to Whammy | drawFrames | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function asyncLoop(o) {
var i = -1,
length = o.length;
(function loop() {
i++;
if (i === length) {
o.callback();
return;
}
// "setTimeout" added by Jim McLeod
setTimeout(function() {
... | Draw and push frames to Whammy
@param {integer} frameInterval - set minimum interval (in milliseconds) between each time we push a frame to Whammy | asyncLoop | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function dropBlackFrames(_frames, _framesToCheck, _pixTolerance, _frameTolerance, callback) {
var localCanvas = document.createElement('canvas');
localCanvas.width = canvas.width;
localCanvas.height = canvas.height;
var context2d = localCanvas.getContext('2d');
var resultFrames =... | remove black frames from the beginning to the specified frame
@param {Array} _frames - array of frames to be checked
@param {number} _framesToCheck - number of frame until check will be executed (-1 - will drop all frames until frame not matched will be found)
@param {number} _pixTolerance - 0 - very strict (only black... | dropBlackFrames | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
finishImage = function() {
if (!doNotCheckNext && maxPixCount - matchPixCount <= maxPixCount * frameTolerance) {
// console.log('removed black frame : ' + f + ' ; frame duration ' + _frames[f].duration);
} else {
// console.log('fra... | remove black frames from the beginning to the specified frame
@param {Array} _frames - array of frames to be checked
@param {number} _framesToCheck - number of frame until check will be executed (-1 - will drop all frames until frame not matched will be found)
@param {number} _pixTolerance - 0 - very strict (only black... | finishImage | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function clearRecordedDataCB() {
whammy.frames = [];
isStopDrawing = true;
isPausedRecording = false;
} | This method resets currently recorded data.
@method
@memberof WhammyRecorder
@example
recorder.clearRecordedData(); | clearRecordedDataCB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function processInWebWorker(_function) {
var blob = URL.createObjectURL(new Blob([_function.toString(),
'this.onmessage = function (eee) {' + _function.name + '(eee.data);}'
], {
type: 'application/javascript'
}));
var worker = new Worker(blob);
URL.revo... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | processInWebWorker | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function whammyInWebWorker(frames) {
function ArrayToWebM(frames) {
var info = checkFrames(frames);
if (!info) {
return [];
}
var clusterMaxDuration = 30000;
var EBML = [{
'id': 0x1a45dfa3, // EBML
'dat... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | whammyInWebWorker | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function ArrayToWebM(frames) {
var info = checkFrames(frames);
if (!info) {
return [];
}
var clusterMaxDuration = 30000;
var EBML = [{
'id': 0x1a45dfa3, // EBML
'data': [{
'data': 1,
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | ArrayToWebM | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function getClusterData(clusterTimecode, clusterCounter, clusterFrames) {
return [{
'data': clusterTimecode,
'id': 0xe7 // Timecode
}].concat(clusterFrames.map(function(webp) {
var block = makeSimpleBlock({
discardable: 0,
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | getClusterData | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function checkFrames(frames) {
if (!frames[0]) {
postMessage({
error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'
});
return;
}
var width = frames[0].width,
hei... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | checkFrames | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function numToBuffer(num) {
var parts = [];
while (num > 0) {
parts.push(num & 0xff);
num = num >> 8;
}
return new Uint8Array(parts.reverse());
} | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | numToBuffer | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function strToBuffer(str) {
return new Uint8Array(str.split('').map(function(e) {
return e.charCodeAt(0);
}));
} | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | strToBuffer | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function bitsToBuffer(bits) {
var data = [];
var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';
bits = pad + bits;
for (var i = 0; i < bits.length; i += 8) {
data.push(parseInt(bits.substr(i, 8), 2));
}
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | bitsToBuffer | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function generateEBML(json) {
var ebml = [];
for (var i = 0; i < json.length; i++) {
var data = json[i].data;
if (typeof data === 'object') {
data = generateEBML(data);
}
if (typeof data === 'number') {
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | generateEBML | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function toBinStrOld(bits) {
var data = '';
var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';
bits = pad + bits;
for (var i = 0; i < bits.length; i += 8) {
data += String.fromCharCode(parseInt(bits.substr(i, 8), 2));
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | toBinStrOld | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function makeSimpleBlock(data) {
var flags = 0;
if (data.keyframe) {
flags |= 128;
}
if (data.invisible) {
flags |= 8;
}
if (data.lacing) {
flags |= (data.lacing << 1);
}
i... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | makeSimpleBlock | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function parseWebP(riff) {
var VP8 = riff.RIFF[0].WEBP[0];
var frameStart = VP8.indexOf('\x9d\x01\x2a'); // A VP8 keyframe starts with the 0x9d012a header
for (var i = 0, c = []; i < 4; i++) {
c[i] = VP8.charCodeAt(frameStart + 3 + i);
}
var ... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | parseWebP | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function getStrLength(string, offset) {
return parseInt(string.substr(offset + 4, 4).split('').map(function(i) {
var unpadded = i.charCodeAt(0).toString(2);
return (new Array(8 - unpadded.length + 1)).join('0') + unpadded;
}).join(''), 2);
} | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | getStrLength | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function parseRIFF(string) {
var offset = 0;
var chunks = {};
while (offset < string.length) {
var id = string.substr(offset, 4);
var len = getStrLength(string, offset);
var data = string.substr(offset + 4 + 4, len);
of... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | parseRIFF | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function doubleToString(num) {
return [].slice.call(
new Uint8Array((new Float64Array([num])).buffer), 0).map(function(e) {
return String.fromCharCode(e);
}).reverse().join('');
} | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | doubleToString | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function putInDB() {
var transaction = db.transaction([self.dataStoreName], 'readwrite');
if (self.videoBlob) {
transaction.objectStore(self.dataStoreName).put(self.videoBlob, 'videoBlob');
}
if (self.gifBlob) {
transaction.objectStore(se... | This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.
@method
@memberof DiskStorage
@internal
@example
DiskStorage.init(); | putInDB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function getFromStore(portionName) {
transaction.objectStore(self.dataStoreName).get(portionName).onsuccess = function(event) {
if (self.callback) {
self.callback(event.target.result, portionName);
}
};
} | This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.
@method
@memberof DiskStorage
@internal
@example
DiskStorage.init(); | getFromStore | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function drawVideoFrame(time) {
if (self.clearedRecordedData === true) {
return;
}
if (isPausedRecording) {
return setTimeout(function() {
drawVideoFrame(time);
}, 100);
}
lastAnimationFrame... | This method records MediaStream.
@method
@memberof GifRecorder
@example
recorder.record(); | drawVideoFrame | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function clearRecordedDataCB() {
if (gifEncoder) {
gifEncoder.stream().bin = [];
}
} | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | clearRecordedDataCB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function MultiStreamsMixer(arrayOfMediaStreams, elementClass) {
var browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';
(function(that) {
if (typeof RecordRTC !== 'undefined') {
return;
}
if (!that) {
re... | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | MultiStreamsMixer | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function setSrcObject(stream, element) {
if ('srcObject' in element) {
element.srcObject = stream;
} else if ('mozSrcObject' in element) {
element.mozSrcObject = stream;
} else {
element.srcObject = stream;
}
} | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | setSrcObject | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function drawVideosToCanvas() {
if (isStopDrawingFrames) {
return;
}
var videosLength = videos.length;
var fullcanvas = false;
var remaining = [];
videos.forEach(function(video) {
if (!video.stream) {
video.stream = {};
... | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | drawVideosToCanvas | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function drawImage(video, idx) {
if (isStopDrawingFrames) {
return;
}
var x = 0;
var y = 0;
var width = video.width;
var height = video.height;
if (idx === 1) {
x = video.width;
}
if (idx === 2) {
y = video.he... | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | drawImage | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function getMixedStream() {
isStopDrawingFrames = false;
var mixedVideoStream = getMixedVideoStream();
var mixedAudioStream = getMixedAudioStream();
if (mixedAudioStream) {
mixedAudioStream.getTracks().filter(function(t) {
return t.kind === 'audio';
... | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | getMixedStream | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function getMixedVideoStream() {
resetVideoStreams();
var capturedStream;
if ('captureStream' in canvas) {
capturedStream = canvas.captureStream();
} else if ('mozCaptureStream' in canvas) {
capturedStream = canvas.mozCaptureStream();
} else if (!self.di... | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | getMixedVideoStream | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function getMixedAudioStream() {
// via: @pehrsons
if (!Storage.AudioContextConstructor) {
Storage.AudioContextConstructor = new Storage.AudioContext();
}
self.audioContext = Storage.AudioContextConstructor;
self.audioSources = [];
if (self.useGainNode === ... | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | getMixedAudioStream | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function getVideo(stream) {
var video = document.createElement('video');
setSrcObject(stream, video);
video.className = elementClass;
video.muted = true;
video.volume = 0;
video.width = stream.width || self.width || 360;
video.height = stream.height || self.he... | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | getVideo | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function resetVideoStreams(streams) {
videos = [];
streams = streams || arrayOfMediaStreams;
// via: @adrian-ber
streams.forEach(function(stream) {
if (!stream.getTracks().filter(function(t) {
return t.kind === 'video';
}).length) {
... | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | resetVideoStreams | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function getAllVideoTracks() {
var tracks = [];
arrayOfMediaStreams.forEach(function(stream) {
getTracks(stream, 'video').forEach(function(track) {
tracks.push(track);
});
});
return tracks;
} | This method records all MediaStreams.
@method
@memberof MultiStreamRecorder
@example
recorder.record(); | getAllVideoTracks | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function terminate() {
if (!worker) {
return;
}
worker.postMessage(null);
worker.terminate();
worker = null;
} | This method resumes the recording process.
@method
@memberof WebAssemblyRecorder
@example
recorder.resume(); | terminate | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/RecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/RecordRTC.js | MIT |
function clearRecordedDataCB() {
whammy.frames = [];
isRecording = false;
isPausedRecording = false;
} | This method resets currently recorded data.
@method
@memberof CanvasRecorder
@example
recorder.clearRecordedData(); | clearRecordedDataCB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/CanvasRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/CanvasRecorder.js | MIT |
function cloneCanvas() {
//create a new canvas
var newCanvas = document.createElement('canvas');
var context = newCanvas.getContext('2d');
//set dimensions
newCanvas.width = htmlElement.width;
newCanvas.height = htmlElement.height;
//apply the old canvas to the ... | This method resets currently recorded data.
@method
@memberof CanvasRecorder
@example
recorder.clearRecordedData(); | cloneCanvas | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/CanvasRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/CanvasRecorder.js | MIT |
function drawCanvasFrame() {
if (isPausedRecording) {
lastTime = new Date().getTime();
return setTimeout(drawCanvasFrame, 500);
}
if (htmlElement.nodeName.toLowerCase() === 'canvas') {
var duration = new Date().getTime() - lastTime;
// via #206, b... | This method resets currently recorded data.
@method
@memberof CanvasRecorder
@example
recorder.clearRecordedData(); | drawCanvasFrame | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/CanvasRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/CanvasRecorder.js | MIT |
function bytesToSize(bytes) {
var k = 1000;
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes === 0) {
return '0 Bytes';
}
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(k)), 10);
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
} | Return human-readable file size.
@param {number} bytes - Pass bytes and get formatted string.
@returns {string} - formatted string
@example
bytesToSize(1024*1024*5) === '5 GB'
@see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} | bytesToSize | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Cross-Browser-Declarations.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Cross-Browser-Declarations.js | MIT |
function invokeSaveAsDialog(file, fileName) {
if (!file) {
throw 'Blob object is required.';
}
if (!file.type) {
try {
file.type = 'video/webm';
} catch (e) {}
}
var fileExtension = (file.type || 'video/webm').split('/')[1];
if (fileName && fileName.indexOf... | @param {Blob} file - File or Blob object. This parameter is required.
@param {string} fileName - Optional file name e.g. "Recorded-Video.webm"
@example
invokeSaveAsDialog(blob or file, [optional] fileName);
@see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} | invokeSaveAsDialog | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Cross-Browser-Declarations.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Cross-Browser-Declarations.js | MIT |
function isElectron() {
// Renderer process
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
return true;
}
// Main process
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electr... | from: https://github.com/cheton/is-electron/blob/master/index.js | isElectron | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Cross-Browser-Declarations.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Cross-Browser-Declarations.js | MIT |
function getTracks(stream, kind) {
if (!stream || !stream.getTracks) {
return [];
}
return stream.getTracks().filter(function(t) {
return t.kind === (kind || 'audio');
});
} | from: https://github.com/cheton/is-electron/blob/master/index.js | getTracks | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Cross-Browser-Declarations.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Cross-Browser-Declarations.js | MIT |
function setSrcObject(stream, element) {
if ('srcObject' in element) {
element.srcObject = stream;
} else if ('mozSrcObject' in element) {
element.mozSrcObject = stream;
} else {
element.srcObject = stream;
}
} | from: https://github.com/cheton/is-electron/blob/master/index.js | setSrcObject | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Cross-Browser-Declarations.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Cross-Browser-Declarations.js | MIT |
function getSeekableBlob(inputBlob, callback) {
// EBML.js copyrights goes to: https://github.com/legokichi/ts-ebml
if (typeof EBML === 'undefined') {
throw new Error('Please link: https://www.webrtc-experiment.com/EBML.js');
}
var reader = new EBML.Reader();
var decoder = new EBML.Decoder(... | @param {Blob} file - File or Blob object.
@param {function} callback - Callback function.
@example
getSeekableBlob(blob or file, callback);
@see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} | getSeekableBlob | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Cross-Browser-Declarations.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Cross-Browser-Declarations.js | MIT |
function putInDB() {
var transaction = db.transaction([self.dataStoreName], 'readwrite');
if (self.videoBlob) {
transaction.objectStore(self.dataStoreName).put(self.videoBlob, 'videoBlob');
}
if (self.gifBlob) {
transaction.objectStore(se... | This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.
@method
@memberof DiskStorage
@internal
@example
DiskStorage.init(); | putInDB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/DiskStorage.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/DiskStorage.js | MIT |
function getFromStore(portionName) {
transaction.objectStore(self.dataStoreName).get(portionName).onsuccess = function(event) {
if (self.callback) {
self.callback(event.target.result, portionName);
}
};
} | This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.
@method
@memberof DiskStorage
@internal
@example
DiskStorage.init(); | getFromStore | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/DiskStorage.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/DiskStorage.js | MIT |
function drawVideoFrame(time) {
if (self.clearedRecordedData === true) {
return;
}
if (isPausedRecording) {
return setTimeout(function() {
drawVideoFrame(time);
}, 100);
}
lastAnimationFrame... | This method records MediaStream.
@method
@memberof GifRecorder
@example
recorder.record(); | drawVideoFrame | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/GifRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/GifRecorder.js | MIT |
function clearRecordedDataCB() {
if (gifEncoder) {
gifEncoder.stream().bin = [];
}
} | This method resets currently recorded data.
@method
@memberof GifRecorder
@example
recorder.clearRecordedData(); | clearRecordedDataCB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/GifRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/GifRecorder.js | MIT |
function updateTimeStamp() {
self.timestamps.push(new Date().getTime());
if (typeof config.onTimeStamp === 'function') {
config.onTimeStamp(self.timestamps[self.timestamps.length - 1], self.timestamps);
}
} | @property {Array} timestamps - Array of time stamps
@memberof MediaStreamRecorder
@example
console.log(recorder.timestamps); | updateTimeStamp | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/MediaStreamRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/MediaStreamRecorder.js | MIT |
function getMimeType(secondObject) {
if (mediaRecorder && mediaRecorder.mimeType) {
return mediaRecorder.mimeType;
}
return secondObject.mimeType || 'video/webm';
} | @property {Array} timestamps - Array of time stamps
@memberof MediaStreamRecorder
@example
console.log(recorder.timestamps); | getMimeType | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/MediaStreamRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/MediaStreamRecorder.js | MIT |
function clearRecordedDataCB() {
arrayOfBlobs = [];
mediaRecorder = null;
self.timestamps = [];
} | This method resets currently recorded data.
@method
@memberof MediaStreamRecorder
@example
recorder.clearRecordedData(); | clearRecordedDataCB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/MediaStreamRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/MediaStreamRecorder.js | MIT |
function isMediaStreamActive() {
if ('active' in mediaStream) {
if (!mediaStream.active) {
return false;
}
} else if ('ended' in mediaStream) { // old hack
if (mediaStream.ended) {
return false;
}
}
return tr... | Access to native MediaRecorder API
@method
@memberof MediaStreamRecorder
@instance
@example
var internal = recorder.getInternalRecorder();
internal.ondataavailable = function() {}; // override
internal.stream, internal.onpause, internal.onstop, etc.
@returns {Object} Returns internal recording object. | isMediaStreamActive | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/MediaStreamRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/MediaStreamRecorder.js | MIT |
function getDataURL(blob, callback00) {
if (typeof Worker !== 'undefined') {
var webWorker = processInWebWorker(function readFile(_blob) {
postMessage(new FileReaderSync().readAsDataURL(_blob));
});
webWorker.onmessage = function(event) {
... | This method can be used to manually get all recorded blobs' DataURLs.
@param {function} callback - All recorded blobs' DataURLs are passed back to the "callback" function.
@method
@memberof MRecordRTC
@example
recorder.getDataURL(function(recording){
var audioDataURL = recording.audio;
var videoDataURL = record... | getDataURL | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/MRecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/MRecordRTC.js | MIT |
function processInWebWorker(_function) {
var blob = URL.createObjectURL(new Blob([_function.toString(),
'this.onmessage = function (eee) {' + _function.name + '(eee.data);}'
], {
type: 'application/javascript'
}));
var worker = new Worker... | This method can be used to manually get all recorded blobs' DataURLs.
@param {function} callback - All recorded blobs' DataURLs are passed back to the "callback" function.
@method
@memberof MRecordRTC
@example
recorder.getDataURL(function(recording){
var audioDataURL = recording.audio;
var videoDataURL = record... | processInWebWorker | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/MRecordRTC.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/MRecordRTC.js | MIT |
function getAllVideoTracks() {
var tracks = [];
arrayOfMediaStreams.forEach(function(stream) {
getTracks(stream, 'video').forEach(function(track) {
tracks.push(track);
});
});
return tracks;
} | This method records all MediaStreams.
@method
@memberof MultiStreamRecorder
@example
recorder.record(); | getAllVideoTracks | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/MultiStreamRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/MultiStreamRecorder.js | MIT |
function isMediaStreamActive() {
if (config.checkForInactiveTracks === false) {
// always return "true"
return true;
}
if ('active' in mediaStream) {
if (!mediaStream.active) {
return false;
}
} else if ('ended' in mediaStr... | Set sample rates such as 8K or 16K. Reference: http://stackoverflow.com/a/28977136/552182
@property {number} desiredSampRate - Desired Bits per sample * 1000
@memberof StereoAudioRecorder
@instance
@example
var recorder = StereoAudioRecorder(mediaStream, {
desiredSampRate: 16 * 1000 // bits-per-sample * 1000
}); | isMediaStreamActive | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function mergeLeftRightBuffers(config, callback) {
function mergeAudioBuffers(config, cb) {
var numberOfAudioChannels = config.numberOfAudioChannels;
// todo: "slice(0)" --- is it causes loop? Should be removed?
var leftBuffers = config.leftBuffers.slice(0);
var ... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | mergeLeftRightBuffers | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function mergeAudioBuffers(config, cb) {
var numberOfAudioChannels = config.numberOfAudioChannels;
// todo: "slice(0)" --- is it causes loop? Should be removed?
var leftBuffers = config.leftBuffers.slice(0);
var rightBuffers = config.rightBuffers.slice(0);
va... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | mergeAudioBuffers | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function interpolateArray(data, newSampleRate, oldSampleRate) {
var fitCount = Math.round(data.length * (newSampleRate / oldSampleRate));
var newData = [];
var springFactor = Number((data.length - 1) / (fitCount - 1));
newData[0] = data[0];
... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | interpolateArray | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function linearInterpolate(before, after, atPoint) {
return before + (after - before) * atPoint;
} | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | linearInterpolate | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function mergeBuffers(channelBuffer, rLength) {
var result = new Float64Array(rLength);
var offset = 0;
var lng = channelBuffer.length;
for (var i = 0; i < lng; i++) {
var buffer = channelBuffer[i];
result.set(buffe... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | mergeBuffers | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function interleave(leftChannel, rightChannel) {
var length = leftChannel.length + rightChannel.length;
var result = new Float64Array(length);
var inputIndex = 0;
for (var index = 0; index < length;) {
result[index++] = leftChannel[i... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | interleave | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function writeUTFBytes(view, offset, string) {
var lng = string.length;
for (var i = 0; i < lng; i++) {
view.setUint8(offset + i, string.charCodeAt(i));
}
} | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | writeUTFBytes | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function processInWebWorker(_function) {
var workerURL = URL.createObjectURL(new Blob([_function.toString(),
';this.onmessage = function (eee) {' + _function.name + '(eee.data);}'
], {
type: 'application/javascript'
}));
var worker = new Worker(workerURL);
... | This method records MediaStream.
@method
@memberof StereoAudioRecorder
@example
recorder.record(); | processInWebWorker | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function resetVariables() {
leftchannel = [];
rightchannel = [];
recordingLength = 0;
isAudioProcessStarted = false;
recording = false;
isPaused = false;
context = null;
self.leftchannel = leftchannel;
self.rightchannel = rightchannel;
sel... | This method resets currently recorded data.
@method
@memberof StereoAudioRecorder
@example
recorder.clearRecordedData(); | resetVariables | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function clearRecordedDataCB() {
if (jsAudioNode) {
jsAudioNode.onaudioprocess = null;
jsAudioNode.disconnect();
jsAudioNode = null;
}
if (audioInput) {
audioInput.disconnect();
audioInput = null;
}
resetVariables();
... | This method resets currently recorded data.
@method
@memberof StereoAudioRecorder
@example
recorder.clearRecordedData(); | clearRecordedDataCB | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function onAudioProcessDataAvailable(e) {
if (isPaused) {
return;
}
if (isMediaStreamActive() === false) {
if (!config.disableLogs) {
console.log('MediaStream seems stopped.');
}
jsAudioNode.disconnect();
recording = fa... | This method resets currently recorded data.
@method
@memberof StereoAudioRecorder
@example
recorder.clearRecordedData(); | onAudioProcessDataAvailable | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function looper() {
if (!recording || typeof config.ondataavailable !== 'function' || typeof config.timeSlice === 'undefined') {
return;
}
if (intervalsBasedBuffers.left.length) {
mergeLeftRightBuffers({
desiredSampRate: desiredSampRate,
s... | This method is called on "onaudioprocess" event's first invocation.
@method {function} onAudioProcessStarted
@memberof StereoAudioRecorder
@example
recorder.onAudioProcessStarted: function() { }; | looper | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/StereoAudioRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/StereoAudioRecorder.js | MIT |
function terminate() {
if (!worker) {
return;
}
worker.postMessage(null);
worker.terminate();
worker = null;
} | This method resumes the recording process.
@method
@memberof WebAssemblyRecorder
@example
recorder.resume(); | terminate | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/WebAssemblyRecorder.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/WebAssemblyRecorder.js | MIT |
function processInWebWorker(_function) {
var blob = URL.createObjectURL(new Blob([_function.toString(),
'this.onmessage = function (eee) {' + _function.name + '(eee.data);}'
], {
type: 'application/javascript'
}));
var worker = new Worker(blob);
URL.revo... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | processInWebWorker | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function whammyInWebWorker(frames) {
function ArrayToWebM(frames) {
var info = checkFrames(frames);
if (!info) {
return [];
}
var clusterMaxDuration = 30000;
var EBML = [{
'id': 0x1a45dfa3, // EBML
'dat... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | whammyInWebWorker | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function ArrayToWebM(frames) {
var info = checkFrames(frames);
if (!info) {
return [];
}
var clusterMaxDuration = 30000;
var EBML = [{
'id': 0x1a45dfa3, // EBML
'data': [{
'data': 1,
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | ArrayToWebM | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function getClusterData(clusterTimecode, clusterCounter, clusterFrames) {
return [{
'data': clusterTimecode,
'id': 0xe7 // Timecode
}].concat(clusterFrames.map(function(webp) {
var block = makeSimpleBlock({
discardable: 0,
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | getClusterData | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function checkFrames(frames) {
if (!frames[0]) {
postMessage({
error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'
});
return;
}
var width = frames[0].width,
hei... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | checkFrames | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function numToBuffer(num) {
var parts = [];
while (num > 0) {
parts.push(num & 0xff);
num = num >> 8;
}
return new Uint8Array(parts.reverse());
} | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | numToBuffer | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function strToBuffer(str) {
return new Uint8Array(str.split('').map(function(e) {
return e.charCodeAt(0);
}));
} | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | strToBuffer | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function bitsToBuffer(bits) {
var data = [];
var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';
bits = pad + bits;
for (var i = 0; i < bits.length; i += 8) {
data.push(parseInt(bits.substr(i, 8), 2));
}
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | bitsToBuffer | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function generateEBML(json) {
var ebml = [];
for (var i = 0; i < json.length; i++) {
var data = json[i].data;
if (typeof data === 'object') {
data = generateEBML(data);
}
if (typeof data === 'number') {
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | generateEBML | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function toBinStrOld(bits) {
var data = '';
var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';
bits = pad + bits;
for (var i = 0; i < bits.length; i += 8) {
data += String.fromCharCode(parseInt(bits.substr(i, 8), 2));
... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | toBinStrOld | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function makeSimpleBlock(data) {
var flags = 0;
if (data.keyframe) {
flags |= 128;
}
if (data.invisible) {
flags |= 8;
}
if (data.lacing) {
flags |= (data.lacing << 1);
}
i... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | makeSimpleBlock | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function parseWebP(riff) {
var VP8 = riff.RIFF[0].WEBP[0];
var frameStart = VP8.indexOf('\x9d\x01\x2a'); // A VP8 keyframe starts with the 0x9d012a header
for (var i = 0, c = []; i < 4; i++) {
c[i] = VP8.charCodeAt(frameStart + 3 + i);
}
var ... | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | parseWebP | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
function getStrLength(string, offset) {
return parseInt(string.substr(offset + 4, 4).split('').map(function(i) {
var unpadded = i.charCodeAt(0).toString(2);
return (new Array(8 - unpadded.length + 1)).join('0') + unpadded;
}).join(''), 2);
} | Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.
@method
@memberof Whammy
@example
recorder = new Whammy().Video(0.8, 100);
recorder.add(canvas || context || 'image/webp');
@param {string} frame - Canvas || Context || image/webp
@param {number} duration - Stick a duration (in milliseconds) | getStrLength | javascript | muaz-khan/WebRTC-Experiment | RecordRTC/dev/Whammy.js | https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.