top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can we embed Audio or video in HTML 5

+3 votes
367 views
How can we embed Audio or video in HTML 5
posted Jan 26, 2014 by Prachi Agarwal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Embedding video

Case 1:

<video width="640" height="360" src="/demo/google_main.mp4?2" autobuffer>
    <div class="fallback">
        <p>You must have an HTML5 capable browser.</p>
    </div>
</video>

Case 2: You can embed your video using the tag for browsers that support HTML 5 and fallback on Flash for those that don’t.

<video src="video.mp4" controls>
    <object data="player.swf" type="application/x-shockwave-flash">
        <param value="player.swf" name="movie"/>
        ...etc...
    </object>
</video>

Embedding Audio

The audio tag is more or less a duplicate of the video tag. The same codec limitations apply — Mozilla only supports Ogg Vorbis files, while Safari can handle pretty much anything QuickTime can.

<audio src="/music/myaudio.ogg" autoplay>
    Sorry, your browser does not support the <audio> element.
</audio>
answer Jan 26, 2014 by Sheetal Chauhan
...