Comparing version 1.0.0 to 2.0.0
{ | ||
"name": "recordrtc", | ||
"preferGlobal": true, | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"author": { | ||
@@ -48,4 +48,4 @@ "name": "Muaz Khan", | ||
"homepage": "https://github.com/muaz-khan/WebRTC-Experiment", | ||
"_id": "recordrtc@1.0.0", | ||
"_id": "recordrtc@2.0.0", | ||
"_from": "recordrtc@" | ||
} |
@@ -1,2 +0,2 @@ | ||
// Last time updated at Tuesday, 26 January 2014, 06:46:23 | ||
// Last time updated at Tuesday, 29 January 2014, 06:46:23 | ||
@@ -551,3 +551,4 @@ // Muaz Khan - www.MuazKhan.com | ||
// ~10 fps | ||
if (time - lastFrameTime < 10) return; | ||
// console.log(time, lastFrameTime, time - lastFrameTime, time - lastFrameTime < 90); | ||
// if (time - lastFrameTime < 90) return; | ||
@@ -944,6 +945,2 @@ context.drawImage(video, 0, 0, canvas.width, canvas.height); | ||
if (data.length) { | ||
var z = z; | ||
} | ||
var len = data.size || data.byteLength || data.length; | ||
@@ -1008,4 +1005,2 @@ var zeroes = Math.ceil(Math.ceil(Math.log(len) / Math.log(2)) / 8); | ||
// here's something else taken verbatim from weppy, awesome rite? | ||
function parseWebP(riff) { | ||
@@ -1017,3 +1012,3 @@ var VP8 = riff.RIFF[0].WEBP[0]; | ||
var width, horizontal_scale, height, vertical_scale, tmp; | ||
var width, height, tmp; | ||
@@ -1023,6 +1018,4 @@ //the code below is literally copied verbatim from the bitstream spec | ||
width = tmp & 0x3FFF; | ||
horizontal_scale = tmp >> 14; | ||
tmp = (c[3] << 8) | c[2]; | ||
height = tmp & 0x3FFF; | ||
vertical_scale = tmp >> 14; | ||
return { | ||
@@ -1078,7 +1071,7 @@ width: width, | ||
} | ||
if ('toDataURL' in frame) { | ||
frame = frame.toDataURL('image/webp', this.quality); | ||
} | ||
if (!( /^data:image\/webp;base64,/ig ).test(frame)) { | ||
@@ -1210,11 +1203,15 @@ throw "Input must be formatted properly as a base64 encoded DataURI of type image/webp"; | ||
if (this.mediaType.video) { | ||
this.videoRecorder = RecordRTC(mediaStream, mergeProps(this, { | ||
type: 'video' | ||
})).startRecording(); | ||
this.videoRecorder = RecordRTC(mediaStream, { | ||
type: 'video', | ||
canvas: this.canvas || { }, | ||
video: this.video || { } | ||
}).startRecording(); | ||
} | ||
if (this.mediaType.gif) { | ||
this.gifRecorder = RecordRTC(mediaStream, mergeProps(this, { | ||
type: 'gif' | ||
})).startRecording(); | ||
this.gifRecorder = RecordRTC(mediaStream, { | ||
type: 'gif', | ||
frameRate: this.frameRate || 200, | ||
quality: this.quality || 10 | ||
}).startRecording(); | ||
} | ||
@@ -1224,4 +1221,3 @@ }; | ||
this.stopRecording = function(callback) { | ||
callback = callback || function() { | ||
}; | ||
callback = callback || function() {}; | ||
@@ -1264,2 +1260,40 @@ if (this.audioRecorder) { | ||
this.getDataURL = function(callback) { | ||
this.getBlob(function(blob) { | ||
getDataURL(blob.audio, function(_audioDataURL) { | ||
getDataURL(blob.video, function(_videoDataURL) { | ||
callback({ | ||
audio: _audioDataURL, | ||
video: _videoDataURL | ||
}); | ||
}); | ||
}); | ||
}); | ||
function getDataURL(blob, callback00) { | ||
if (!!window.Worker) { | ||
var webWorker = processInWebWorker(function readFile(_blob) { | ||
postMessage(new FileReaderSync().readAsDataURL(_blob)); | ||
}); | ||
webWorker.onmessage = function(event) { | ||
callback00(event.data); | ||
}; | ||
webWorker.postMessage(blob); | ||
} | ||
} | ||
function processInWebWorker(_function) { | ||
var blob = URL.createObjectURL(new Blob([_function.toString(), | ||
'this.onmessage = function (e) {readFile(e.data);}'], { | ||
type: 'application/javascript' | ||
})); | ||
var worker = new Worker(blob); | ||
URL.revokeObjectURL(blob); | ||
return worker; | ||
} | ||
}; | ||
this.writeToDisk = function() { | ||
@@ -1266,0 +1300,0 @@ RecordRTC.writeToDisk({ |
Sorry, the diff of this file is not supported yet
98351
14
1310