Jump to content

Using video from Webcam as a Source for the video texture

Raghavender Mylagary

Recommended Posts

I got the solution. Below script worked for me :)


<script type="text/javascript">

            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,

                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
                }, function(error){
            } else {
                console.log("Browser does not support WebCam integration");


Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...