How to display properly a shortened URL which can hold either video or image file? The URL does not contain extension and the domain can be of different origin. I need to use either video or image tag depending on the source type so it is rendered correctly by browser. The solution can be with JavaScript or markup.

Example:  

[IMAGE] <http://bit.ly/1uI7Ddj>  

[VIDEO] <http://bit.ly/1vvkYJ1>

I tried following but it doesn't work as expected:

```
<video width="300" height="150" src="http://bit.ly/1uI7Ddj">
    <img width="300" height="150" src="http://bit.ly/1uI7Ddj" alt="Fallback if video is not playing" />
</video>

```