I have a video tag in my video-sharing website
<video src="/video-123"></video>
The video is uploaded by users, which can be MP4, MOV,... and can be played on some browser, while others cannot (based on video encoding, for example H.264 is widely supported, but H.265 or HEVC only supported on newer Safari).
In the case the browser cannot play the video, I want to detect by Javascript on that browser, in order to show an error message to users. How can I do that? Please help me.
Just insert any HTML tag inside <video> tag. Browsers which are supporting video format just will replace it.
<video src="/video-123">
<div>Your browser does not support HTML5 video.</div>
</video>
or:
<video>
<source src="/video-123.mp4" type="video/mp4">
<source src="/video-123.ogg" type="video/ogg">
<div>Your browser does not support HTML5 video.</div>
</video>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With