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.
var video = document.querySelector('video');
video.srcObject = stream;
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
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 😎
There is a reason big-name companies like CNN use WordPress. WordPress is a popular content…
In this tutorial, I'm going to show you how to install MySQL on your computer.…
Download Turbo C++ for windows 10 in just 7 Mb and run your first C++…
We can redirect any webpage to any other or redirect the whole domain or website…
There are lots of methods to redirect pages, like refresh-redirect from META tag, redirect from…
Include files in PHP are used in appending various global or config files. We can…