[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 😎

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Read previous post:
remove category from category archives page title
How to Remove “Category:” From Category Archive Pages in WordPress

WordPress provides all the basic functionality for blogging and rapid website development. The majority of bloggers use WordPress for their...

Close