'Using mp4 or jpg interchangeably

In my app I have some posts that have a URL to a resource which returns either a JPG (Image) or an mp4 (Video).

As of now, I have no way of finding out, which one it is. I found that Safari in some preview allowed the img-Tag to have mp4 in it's source but it doesn't seem to work on chrome.

I also tried to use the video-tag with different <source>-Tags with no luck.

Is there an HTML-Way of rendering a resource no matter the MIME-Type? Otherwise I would have to save with each resource, what kind of resource it is so I can use an IMG- or a VIDEO-Tag depending on the value.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source