HTML video (Videos)

Playing videos in HTML is not easy!

You need a lot of skill to make sure your video files are playable in all browsers (Internet Explorer, Chrome, Firefox, Safari, Opera) and all hardware (PC, Mac, iPad, iPhone).

In this chapter, We summarizes the problems and solutions for you.

Use the <embed> tag

The <embed> tag is used to embed multimedia elements in HTML pages.

The following HTML code shows a Flash video embedded in a webpage:

Instance

Find a video in swf format, try running it.

Problem

HTML4 does not recognize the <embed> tag. Your page could not be verified.

If the browser does not support Flash, the video will not play.

iPad and iPhone cannot display Flash video.

If you convert your video to another format, it still won't play in all browsers.

Use the <object> tag

The <object> tag is used to embed multimedia elements in an HTML page.

The following HTML snippet shows a piece of Flash video embedded in a web page:

Problem:
If the browser does not support Flash, the video will not play.

iPad and iPhone cannot display Flash video.

If you convert your video to another format, it still won't play in all browsers.

Use the HTML5 <video> element


The HTML5 <video> tag defines a video or movie.

The <video> element is supported in all modern browsers.

The following HTML snippet shows a video in ogg, mp4, or webm format embedded in a web page:

Find some video formats in the above example, try running the program.

Problem:
You have to convert the video to many different formats.

The <video> element is not valid in older browsers.

The best HTML solution

The different video formats in 4 are used in the following examples. The HTML 5 <video> element attempts to play the video in one of mp4, ogg, or webm formats. If both fail, fall back to the <embed> element.

HTML 5 + <object> + <embed>

Find some video formats in the above example, try running the program.

Problem:

You have to convert the video to many different formats

Youtube solution

The easiest way to display a video in HTML is to use a video site like youtube.

If you want to play a video on a webpage, you can upload the video to a video site like youtube and then insert the HTML code into your webpage to play the video:

Try running the program

Use hyperlinks

If a web page contains a hyperlink to a media file, most browsers use a "helper application" to play the file.

The following code snippet shows a link to an AVI file. If the user clicks on the link, the browser launches a "helper application", such as Windows Media Player, to play the AVI file:

Try to find a video file

Description of inline video

When a video is included in a web page, it is called an inline video.

If you plan to use inline video in your web application, you need to realize that many people find inline video annoying.

Also note that the user may have turned off the inline video option in the browser.

Our best advice is to include them only where users want to see inline videos. A positive example is when a user needs to see a video and click on a link, the page opens and the video plays.

Last Updated: 2018-08-22 13:32:50 By akshay

SHARE THIS

share_facebook share_twitter share_google_plus

Please Comment Here :