title: Video mediaDevices Assign a Blob To 'videoRef.srcObject' In Place of 'src'
body: <p>I am trying to make a blob the src of a video element. My code is working fine when:</p>
  
  <pre><code>videoRef.src = URL.createObjectURL(blob)
  </code></pre>
  
  <p>but using 'src' and 'URL.createObjectURL' is deprecated in place of using 'srcObject' <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL" rel="noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL</a> </p>
  
  <p><a href="https://i.stack.imgur.com/YYk8S.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YYk8S.png" alt="enter image description here"></a></p>
  
  <p>and <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia" rel="noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia</a> </p>
  
  <p><a href="https://i.stack.imgur.com/xTrMj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xTrMj.png" alt="enter image description here"></a></p>
  
  <p>My question is how can I simply add a blob file to the srcObject like so:</p>
  
  <pre><code>videoRef.srcObject = blob
  </code></pre>
  
  <p>When I try the above code I get the error: "TypeError: Failed to set the 'srcObject' property on 'HTMLMediaElement': The provided value is not of type 'MediaStream'."</p>
  
  <p>How can I not use the deprecated videoRef.src and apply a blob directly to videoRef.srcObject ? Or is it ok for blob type to use src, and only streams can't use src ?</p>