title: html5 getUserMedia Cannot set property 'srcObject' of null
body: <p>I have a basic react component, and I am trying to access video within the navigator.mediaDevices.getUserMedia. However, I keep getting 'Cannot set property 'srcObject' of null'</p>
  
  <pre><code>import React, {Component} from 'react';
  
  export default class Example extends Component{
      render(){
  
      const video = document.querySelector('video');
      const constraints = {video:true}
      navigator.mediaDevices.getUserMedia(constraints).then(
  
          (stream) =&gt; {video.srcObject = stream})
  
          return(
          &lt;div&gt;
              &lt;video&gt;
  
              &lt;/video&gt;
          &lt;/div&gt;
          )
      }
  }
  </code></pre>
  
  <p>the above returns:</p>
  
  <p>Cannot set property 'srcObject' of null</p>
  
  <p>Any ideas?</p>