2

i want to attach web cam to a div element.the way i used to do in jquery is like below,How can i attach web cam to a div using angularjs

  <script type="text/javascript">  
        $("#Camera").webcam({  
            width: 320,  
            height: 240,  
            mode: "save",  
            swffile: "@Url.Content("~/Scripts/jscam.swf")",  
            onTick: function () { },  
            onSave: function () {  
                UploadPic();  
            },  
            onCapture: function () {  
                webcam.save("@Url.Content("~/Photo/Capture")/");  
         },  
            debug: function () { },  
            onLoad: function () { }  
        });  
    </script>  
} 

i know i have to create a directive for this. doubt :weather i have to convert all jquery.webcam.js file need to change to directive or any other way is there to do it.

i tried with <ng-Camera></ng-Camera> available on github but it is not supporting in IE

if any one have any help-link to do webcam Capture image accross all the browser pls update here

MMM
  • 3,132
  • 3
  • 20
  • 32

1 Answers1

0

You don't have to rewrite all the webcam files, the only thing you have to remember is when you change something outside of Angular you have to run a $scope.$apply() (or $timeout, which is safer) so Angular knows it should run a digest cycle (this means after every callback such as onLoad, onTick, onSave)

Community
  • 1
  • 1
Martijn Welker
  • 5,575
  • 1
  • 16
  • 26