Merge pull request #187 from atlasan/pulls

WebCamNodeFix
This commit is contained in:
Javi Agenjo
2021-06-14 12:26:37 +02:00
committed by GitHub
2 changed files with 5 additions and 5 deletions

View File

@@ -71,7 +71,7 @@ graph.start();</pre>
<h2>Example of editor</h2> <h2>Example of editor</h2>
<ul> <ul>
<li><a href="demo">Module editor</a></li> <li><a href="editor">Module editor</a></li>
</ul> </ul>
<h2>Documentation</h2> <h2>Documentation</h2>

View File

@@ -734,7 +734,7 @@
// Texture Webcam ***************************************** // Texture Webcam *****************************************
function ImageWebcam() { function ImageWebcam() {
this.addOutput("Webcam", "image"); this.addOutput("Webcam", "image");
this.properties = { facingMode: "user" }; this.properties = { filterFacingMode: false, facingMode: "user" };
this.boxcolor = "black"; this.boxcolor = "black";
this.frame = 0; this.frame = 0;
} }
@@ -744,8 +744,8 @@
ImageWebcam.is_webcam_open = false; ImageWebcam.is_webcam_open = false;
ImageWebcam.prototype.openStream = function() { ImageWebcam.prototype.openStream = function() {
if (!navigator.getUserMedia) { if (!navigator.mediaDevices.getUserMedia) {
//console.log('getUserMedia() is not supported in your browser, use chrome and enable WebRTC from about://flags'); console.log('getUserMedia() is not supported in your browser, use chrome and enable WebRTC from about://flags');
return; return;
} }
@@ -754,7 +754,7 @@
// Not showing vendor prefixes. // Not showing vendor prefixes.
var constraints = { var constraints = {
audio: false, audio: false,
video: { facingMode: this.properties.facingMode } video: !this.properties.filterFacingMode ? true : { facingMode: this.properties.facingMode }
}; };
navigator.mediaDevices navigator.mediaDevices
.getUserMedia(constraints) .getUserMedia(constraints)