@vikasietum_tecknology/record-rtc
Version:
record-rtc is a library based on recordrtc library. In this forked version of the original library we have optimized the memory management. The video recording is stored in IndexDB in chunks.
101 lines (87 loc) • 2.41 kB
JavaScript
var browserFakeUserAgent =
"Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45";
(function(that) {
if (!that) {
return;
}
if (typeof window !== "undefined") {
return;
}
if (typeof global === "undefined") {
return;
}
global.navigator = {
userAgent: browserFakeUserAgent,
getUserMedia: function() {},
};
if (!global.console) {
global.console = {};
}
if (
typeof global.console.log === "undefined" ||
typeof global.console.error === "undefined"
) {
global.console.error = global.console.log =
global.console.log ||
function() {
console.log(arguments);
};
}
if (typeof document === "undefined") {
/*global document:true */
that.document = {
documentElement: {
appendChild: function() {
return "";
},
},
};
document.createElement =
document.captureStream =
document.mozCaptureStream =
function() {
var obj = {
getContext: function() {
return obj;
},
play: function() {},
pause: function() {},
drawImage: function() {},
toDataURL: function() {
return "";
},
style: {},
};
return obj;
};
that.HTMLVideoElement = function() {};
}
if (typeof location === "undefined") {
/*global location:true */
that.location = {
protocol: "file:",
href: "",
hash: "",
};
}
if (typeof screen === "undefined") {
/*global screen:true */
that.screen = {
width: 0,
height: 0,
};
}
if (typeof URL === "undefined") {
/*global screen:true */
that.URL = {
createObjectURL: function() {
return "";
},
revokeObjectURL: function() {
return "";
},
};
}
/*global window:true */
that.window = global;
})(typeof global !== "undefined" ? global : null);