check if a video link is still working

Asked

Viewed 93 times

1

I am developing a site and I use a link q in time in time It gets off, I already have the system I run to update this link but it is in manual mode to run. I was wondering if you have any way to check if the video link is off or not font type see the answer to the code

 <video controls>
      <source src="<?= link que vem do banco de dados ?>" type="video/mp4">
 </video>

1 answer

1


I believe it’s not exactly what you want, but it might help you if you can’t find a solution

The tag <video> has an attribute called poster which serves as a "cover" for the video. This image will appear before you give play, so even if the video does not load this image will appear. This way you can at least give a more controlled feedback if you have this charging problem.

In this example below neither of the two videos will not load, but will appear the image that is set in the poster (https://placecage.com/320/240).

<video controls width="320" height="240" poster="https://placecage.com/320/240" >
  <source src="movie1.mp4" type="video/mp4">
  <source src="movie2.ogg" type="video/ogg">
</video>


Option 2

Another option is to use your own source to leave a video of fallback to the first. Note that in the code below I have two video, the first will fail to load, and then the second that will appear as an option to be played. So you can keep on your server a secure video, which will always work and leave you fallback in case the dynamic video fails to load.

Note that the php tag will not load, and the video of fallback will be available for you to play

<video controls width="320" height="240"  >
   <source src="<?= link que vem do banco de dados ?>" type="video/mp4">
   <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
</video>

  • has as a result of image I request a page?

  • @Cyberhacker guy I updated the answer, had mistaken me on some things, plus I put an explanation on how to make a right fallback videos. About requesting a new page I believe it may be possible yes, even with JS, If something does not click on the page and some error forwards you to another page... Woe would be good if you edit the question too, saying that this too would be an answer for you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.