Created
          August 22, 2019 00:54 
        
      - 
      
- 
        Save guinso/0d596e4cfe2bba480e050cd8f1d8a49a to your computer and use it in GitHub Desktop. 
    Example to run camera on web browser
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | initCamera(videoElement) { | |
| // Grab elements, create settings, etc. | |
| // var video = this.partial.querySelector('#video'); | |
| // Get access to the camera! | |
| if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { | |
| // Not adding `{ audio: true }` since we only want video now | |
| navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) { | |
| //video.src = window.URL.createObjectURL(stream); | |
| videoElement.srcObject = stream; | |
| videoElement.play(); | |
| }); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment