Deepu
Deepu

Reputation: 11

Video tag in HTML5 deos not works when youtube url is given

HTML code :

<!DOCTYPE HTML>
<html>
    <body>
    <form>
        <video width="320" height="240" controls >
            <source src="http://www.youtube.com/watch?feature=player_detailpage&v=kalbVE9QgMs" type="video/mp4">
            no support
        </video>
    </form>
    </body>
</html> 

Getting this:

The Browser is chrome. The youtube url is accesible but not works when put inside video tag.

Upvotes: 1

Views: 4464

Answers (2)

sourav
sourav

Reputation: 676

You need to use some external js library like MediaElement.js

Here is the example http://mediaelementjs.com/examples/?name=youtube

Upvotes: 0

Chris Peters
Chris Peters

Reputation: 18090

You must include the URL of an actual video file within a <video> tag. A YouTube URL like the one in your example is not the URL for a file but rather a webpage containing an embedded player, comments, links to other videos, etc.

With YouTube videos, you must use their embed code on your page for it to work reliably over the long term.

<iframe width="560" height="315" src="//www.youtube.com/embed/kalbVE9QgMs" frameborder="0" allowfullscreen></iframe>

Upvotes: 1

Related Questions