awrtc_browser
Version:
Compatible browser implementation to the Unity asset WebRTC Video Chat. Try examples in build folder
30 lines • 1.12 kB
JavaScript
var VideoInput = /** @class */ (function () {
function VideoInput() {
this.canvasDevices = {};
}
VideoInput.prototype.AddCanvasDevice = function (deviceName, canvas) {
this.canvasDevices[deviceName] = canvas;
};
VideoInput.prototype.RemCanvasDevice = function (deviceName) {
delete this.canvasDevices[deviceName];
};
VideoInput.prototype.HasDevice = function (dev) {
return dev in this.canvasDevices;
};
VideoInput.prototype.GetStream = function (dev) {
if (this.HasDevice(dev)) {
var canvas = this.canvasDevices[dev];
//watch out: This can trigger an exception if getContext has never been called before.
//There doesn't seem to way to detect this beforehand though
var stream = canvas.captureStream();
return stream;
}
return null;
};
VideoInput.prototype.GetDeviceNames = function () {
return Object.keys(this.canvasDevices);
};
return VideoInput;
}());
export { VideoInput };
//# sourceMappingURL=VideoInput.js.map