
This is why you are having a difficult time using the video tag with youtube videos. YouTube embed links are not just videos, they are typically webpages that contain logic to detect what your user supports and how they can play the youtube video, using HTML5, or flash, or some other plugin based on what is available on the users PC.

The tag is meant to load in a video of a supported format (which may differ by browser). Please now use versions 4.0.1 and up! Updated example: YouTube have recently updated their API which has broken previous versions of this package. It decodes the response which includes streaming information we can use to add a source to the tag. What the library does is extract the video ID from the data attribute and makes a request to the. I have created a realtively small (4.89 KB) javascript library for this exact functionality. #JavaScript (after load) videos = document.querySelectorAll("video") įor (var i = 0, l = videos.length i 1) ? id.splice(1) : id It obviously depends on the servers and their way of providing a downloading link (which can be passed as a source), so this answer may not be valid in the future. Abstraction (the accepted solution, even if it worked properly, would only be applicable if you knew beforehand which videos you were going to play, this works for any user inputted url).Quite fast server response actually (it doesn't take that much to retrieve the videos).mp4 format, you can exploit this (with some JavaScript) to get away with embedding youtube videos in tags.

there is a website (youtubeinmp4) that allows you to download youtube videos in. This answer does not work anymore, but I'm looking for a solution.Īs of.
