Chrome update-Failed to execute 'createObjectURL' on 'URL'

后端 未结 4 961
青春惊慌失措
青春惊慌失措 2021-01-31 19:14

I\'m taking an image from the webcam and storing it to the server. Everything was working fine until I got the chrome update today. My latest chrome version is:

相关标签:
4条回答
  • 2021-01-31 19:35

    In chrome, it works fine if you use:

    video.srcObject = stream;
    

    Instead of:

    this.srcObject = stream;
    

    See printscreen here

    0 讨论(0)
  • 2021-01-31 19:36

    It's just been removed from the current version of Chrome. I suddenly started getting this error after it updated. I have no idea why it never printed deprecation warnings before today.

    Instead of setting the src property to URL.createObjectURL(stream) you're now supposed to set the srcObject property to the stream directly. It seems to be working in Chrome and Firefox.

    Source: https://developers.google.com/web/updates/2018/10/chrome-71-deps-rems

    0 讨论(0)
  • 2021-01-31 19:36

    Have you tried this?

    try {
      camera.srcObject = stream;
    } catch (error) {
      camera.src = window.URL.createObjectURL(stream);
    }
    
    0 讨论(0)
  • 2021-01-31 19:53

    Since google update version 71, this issue is generating. I also faced this issue. But now I got the solution to it. Here is the solution:

    Replace

    videoElement.src = URL.createObjectURL(screenStream);
    

    to

    videoElement.srcObject = screenStream;
    
    0 讨论(0)
提交回复
热议问题