Raghavender Mylagary Posted December 19, 2016 Share Posted December 19, 2016 Hi, I am searching for an example where we can set the video from the webcam as the source for the VideoTexture. Thanks, Raghavender Mylagary Quote Link to comment Share on other sites More sharing options...
Raghavender Mylagary Posted December 19, 2016 Author Share Posted December 19, 2016 I got the solution. Below script worked for me <script type="text/javascript"> (function(){ function userMedia(){ return navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || null; } // Now we can use it if( userMedia() ){ var constraints = { video: true, audio:false }; var media = navigator.getUserMedia(constraints, function(stream){ var v = document.getElementById('v'); // URL Object is different in WebKit var url = window.URL || window.webkitURL; // create the url and set the source of the video element v.src = url ? url.createObjectURL(stream) : stream; // Start the video v.play(); }, function(error){ console.log("ERROR"); console.log(error); }); } else { console.log("Browser does not support WebCam integration"); } })(); </script> Quote Link to comment Share on other sites More sharing options...
Sebavan Posted December 19, 2016 Share Posted December 19, 2016 It is embedded in BJS: https://www.babylonjs-playground.com#1R77YT#2 BABYLON.VideoTexture.CreateFromWebCam(scene, function(videoTexture) { }, { maxWidth: 256, maxHeight: 256 }); Raghavender Mylagary 1 Quote Link to comment Share on other sites More sharing options...
Raghavender Mylagary Posted December 20, 2016 Author Share Posted December 20, 2016 Thanks for the info @Sebavan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.