Error

[Solved] Uncaught TypeError: Failed to Execute ‘createObjectURL’ on ‘URL’: No Function Was Found That Matched the Signature Provided

I tried to do some experiments with video steam online, and I found some documents about online video streaming. However, I found an error in my console, as mentioned below.

Uncaught TypeError: Failed to Execute ‘createObjectURL’ on ‘URL’: No Function Was Found That Matched the Signature Provided

My video streaming code was looking like the given below.

var video = document.querySelector('video'); 
video.src = window.URL.createObjectURL(stream); 

I was stuck with the above error for a movement, but finally, I solved it.

The above error occurs in the browser because of the window.URL is no longer suitable for new browsers. Also, video.src is not valid to add live streaming to the video element.

The solution is quite simple, change your code according to my code, as given below.

SOLUTION

var video = document.querySelector('video'); 
video.srcObject = stream;

Explanation

Here we removed the window.URL.createObjectURL method because it is no longer supported in new browsers. We also changed the src attribute of the video element to the srcObject attribute to handle the steam object. After that, the code was running without any errors.

Read Also: [Solved] Error: Could Not Decode a Text Frame As Utf-8 Websocket

Conclusion

I hope the above solution may work for your problem. Please do not write old and unsupported methods. Besides, always check the official documentation for the latest and updated methods to avoid unwanted errors.

Happy Debugging 😎

Nachiket Panchal

Founder & Administrator of `errorsea` Having interest in Programming & Technology.

Recent Posts

5 Important Things To Know About WordPress Before You Use It

There is a reason big-name companies like CNN use WordPress. WordPress is a popular content…

3 years ago

How to Install MySQL on Your PC in 3 Easy Steps

In this tutorial, I'm going to show you how to install MySQL on your computer.…

4 years ago

Download and Install Turbo C++ for Windows 10 (Full Installation Guide)

Download Turbo C++ for windows 10 in just 7 Mb and run your first C++…

5 years ago

PHP .HTACCESS Redirects

We can redirect any webpage to any other or redirect the whole domain or website…

5 years ago

PHP Redirect Pages

There are lots of methods to redirect pages, like refresh-redirect from META tag, redirect from…

5 years ago

PHP Include & Required

Include files in PHP are used in appending various global or config files. We can…

5 years ago