-
-
Save justinyoo/db7b9e5bd7b1405fc5ef7f42330213bd to your computer and use it in GitHub Desktop.
Accessing to Camera on Mobile Devices from Vue.js + TypeScript + ASP.NET Core Applications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
takePhoto (): void { | |
if (!this._hasUserMedia) { | |
return; | |
} | |
var canvas: HTMLCanvasElement = this.getCanvas(); | |
this.photo = canvas.toDataURL(this.screenshotFormat); | |
} | |
private getCanvas (): HTMLCanvasElement { | |
if (!this._hasUserMedia) { | |
return null; | |
} | |
if (this._ctx == null) { | |
var canvas: HTMLCanvasElement = document.createElement("canvas"); | |
canvas.height = this._video.clientHeight; | |
canvas.width = this._video.clientWidth; | |
this._ctx = canvas.getContext("2d"); | |
this._ctx.drawImage(this._video, 0, 0, canvas.width, canvas.height); | |
return canvas; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment