0

I'm looking for a way so a certain embed link from youtube/video/other video provider that doesn't have an API can be wrapped around a HTML5 <video> tag. And if I'm then able to use the HTML5 features of this tag? I'm looking for something like this:

<video width="560" height="315" controls autoplay>
<iframe width="560" height="315" src="http://www.youtube.com/embed/5qm8PH4xAss" frameborder="0" allowfullscreen></iframe>
</video>

or this:

<video width="640" height="505" controls autoplay>
<object width="640" height="505" type="application/x-shockwave-flash" data="http://www.youtube.com/v/YE7VzlLtp-4">
<param name="movie" value="http://www.youtube.com/v/YE7VzlLtp-4" />
</object>
</video>

I'm actually looking to generalise the video providers embedded video options, I would like to be able to call play(), stop(), ... from javascript without limiting to only video providers that have specified an API. I'm basicly looking for something like this: http://www.w3.org/2010/05/video/mediaevents.html

Vjeetje
  • 5,314
  • 5
  • 35
  • 57
  • Does this answer your question? http://stackoverflow.com/questions/6206342/best-way-to-implement-html5-video – Chuck Le Butt Feb 26 '13 at 20:28
  • I'm not sure what you exactly mean. Could you formulate an example code / answer, please? To be clear: I'm NOT looking for a fallback method, I'm just looking for a way to get the functionality given by the HTML5 video tag to be applied to an embeddable link – Vjeetje Feb 26 '13 at 20:33

1 Answers1

1

What you're asking for is not possible unless what you're describing is a direct link to a video file, and even then that's probably not enough, and I'll explain why:

Firstly, the HTML5 <video> element is designed to work with videos, not Flash objects. Secondly, different browsers only support certain video formats:

  • FireFox: OGV, WebM
  • Internet Explorer: MP4
  • Safari/iOS: MP4
  • Chrome: MP4, WebM

So unless you have video sources to an MP4 version of the video AND an OGG version of the video, it won't work in all modern browsers. E.g.:

<video width="640" height="360" controls>
    <source src="__VIDEO__.MP4" type="video/mp4" /><!-- Safari / iOS video    -->
    <source src="__VIDEO__.OGV" type="video/ogg" /><!-- Firefox / Opera / Chrome10 -->
    <!-- Fallback code (e.g. Images, Flash, text, etc.) -->
</video>
Chuck Le Butt
  • 47,570
  • 62
  • 203
  • 289
  • Is there any other HTML5 tag/equivalent / javascript library that helps me to get more control of such an embedded video object (Without resorting to API's of providers like Youtube) ? – Vjeetje Feb 26 '13 at 21:58
  • You're being too vague with this "embedded video object". What are you referring to? Flash? Or just normal HTML5 video? – Chuck Le Butt Feb 26 '13 at 22:11
  • I mean all the or other html tags they use when you click the share button on a video: e.g.: – Vjeetje Feb 26 '13 at 22:25
  • 1
    No. You can't control the contents of an iframe without using an API from the owner of the contents of the iframe. – Chuck Le Butt Feb 26 '13 at 22:52