I am using navigator.getUserMedia to capture webcam images in html5.It works fine till last week.Now getting messages like getUserMedia() no longer works in insecure origins and capturing image from webcam broken . I searched about getUserMedia in web and find it is deprecated and browsers do not support it future. Is there any alternative function for getUserMedia that works in all browsers.

my html code is 

```
  <video id="video" width="640" height="480" autoplay></video>
  <button id="snap" class="sexyButton">Snap</button>
   <canvas id="canvas" width="640" height="480"></canvas>

```

and script function is

```
         <script>
    window.addEventListener("DOMContentLoaded", function() {
        // Grab elements, create settings, etc.
        var canvas = document.getElementById("canvas"),
            context = canvas.getContext("2d"),
            video = document.getElementById("video"),
            videoObj = { "video": true },
            errBack = function(error) {
                console.log("Video capture error: ", error.code); 
            };
        if(navigator.getUserMedia) { // Standard
            navigator.getUserMedia(videoObj, function(stream) {
                video.src = stream;
                video.play();
            }, errBack);
        } else if(navigator.webkitGetUserMedia) { // WebKit-prefixed
            navigator.webkitGetUserMedia(videoObj, function(stream){
                video.src = window.webkitURL.createObjectURL(stream);
                video.play();
            }, errBack);
        } else if(navigator.mozGetUserMedia) { // WebKit-prefixed
            navigator.mozGetUserMedia(videoObj, function(stream){
                video.src = window.URL.createObjectURL(stream);
                video.play();
            }, errBack);
        }

        // Trigger photo take
        document.getElementById("snap").addEventListener("click", function() {
            context.drawImage(video, 0, 0, 640, 480);
        });
    }, false);

         </script>

```