0% found this document useful (0 votes)
2 views

HTML_Multimedia_Examples

top

Uploaded by

dvsking54
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

HTML_Multimedia_Examples

top

Uploaded by

dvsking54
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

HTML Multimedia

What is Multimedia?
Multimedia is any content you can see or hear—like sound, music, videos, pictures, or animations.

Browser Support
Modern browsers support many multimedia formats. Older browsers only supported text.

Multimedia Formats
Multimedia files come in various formats like .mp4, .mp3, .ogg, .webm, .wav, etc. Browsers support only some formats
directly.

Video Formats and HTML Example Output:


Supported formats: MP4, WebM, Ogg A video player with play/pause controls. If "video.mp4" or
Not supported: AVI, WMV, MOV (limited), FLV "video.webm" exists, it plays the video. If not, it shows a
fallback message.

Formats and HTML Example Output:


Supported formats: MP3, WAV, Ogg An audio player with play/pause controls. If "audio.mp3" or
Not supported: WMA, AAC, MIDI "audio.ogg" exists, it plays the audio. If not, it shows a
fallback message.

Image Example Output:


Displays the image named "image.jpg" with a width of
300 pixels. Shows "Example Image" if the image doesn't
load.

Animation Examples
GIF:

Output:
Displays an animated GIF named "animation.gif" with a width of 300 pixels.
CSS Animation: Output:
Shows a red box that moves left to right continuously across 100px.

Tip:
Use multiple sources for audio/video to ensure it works in all browsers.

HTML Video
HTML <video> element is used to embed video files on a webpage.

Basic Example: Output:


Displays a video player 320x240 pixels with play/pause
controls. Plays "movie.mp4" if supported. If not, shows fallback
message.

Autoplay Example:
Automatically play a video when the page loads.
Output:
Video starts playing automatically when the page loads
without sound (muted). No play button is required initially.

Note: muted is required for autoplay to work in most modern browsers.


Loop Example: Output:
Play the video in a continuous loop. A 320x240 video player with controls. The video will restart
automatically every time it ends (loops forever).
Browser Support:
All major browsers support the <video> tag (Chrome, Firefox, Safari, Edge, Opera).

Supported Formats: Media Types:


Format Chrome Firefox Safari Edge Opera Format Media Type

MP4 Yes Yes Yes Yes Yes MP4 video/mp4

WebM Yes Yes No Yes Yes WebM video/webm

Ogg Yes Yes No No Yes Ogg video/ogg

Using JavaScript with Video:

Output:
Displays a video with play/pause controls and two buttons.
Clicking Play starts the video, clicking Pause stops it.

Common Video Attributes:


Attribute Description

controls Adds play, pause, volume controls

autoplay Starts video automatically

loop Loops the video

muted Mutes the video

poster Image shown before the video plays

HTML Audio
The <audio> tag is used to play sound files in a webpage.

Basic Audio Example: Output:


Displays an audio player with play/pause and volume
controls. If the browser supports MP3 or OGG, it plays the
file. If neither format is supported, the fallback text is
shown.
Autoplay Example: Output:
Audio starts playing automatically when the page loads, but it’s
muted. Controls are also shown.

Note: Most browsers block autoplay unless the audio is muted.

How It Works:
controls: adds play, pause, and volume controls.
<source>: supports multiple audio formats for browser compatibility.
Text between <audio> tags shows if the browser doesn’t support audio.

Browser Support:
All major browsers (Chrome, Firefox, Safari, Edge, Opera) support the <audio> element.

Supported Audio Formats:


Format Media Type

MP3 audio/mpeg

WAV audio/wav

OGG audio/ogg

Using JavaScript: Output:


No visible audio player unless
styled. Clicking Play plays
"sound.mp3", and clicking Pause
pauses it.

Common Audio Tags:


Tag Description

<audio> Defines audio content

<source> Defines media source files

HTML Plug-ins
Plug-ins extend browser functionality (e.g., run Java applets, display Flash, play media).
Note: Most plug-ins (Java, Flash, ActiveX) are no longer supported by modern browsers.

Warning !
Most browsers no longer support Java Applets and Plug-ins. ActiveX controls are no longer supported in any browsers.
The support for Shockwave Flash has also been turned off in modern browsers.
The <object> Element
Embeds external files like images, PDFs, or HTML within a page.

• Example – Embed HTML:

Output:
Displays the content of snippet.html inside a 100% wide, 500px tall container. If snippet.html is a valid HTML file, its
content (like text, images, or formatting) is shown embedded on the page.

• Example – Embed Image:

Output:
Shows the image audi1.jpeg inside the object container. If the image exists, it will be rendered just like a normal image
tag.

The <embed> Element


Also embeds content like media or HTML. No closing tag is required.

• Example – Embed Image:

Output:
Displays the image audi1.jpeg directly in the page using the embed tag. Functions similar to an <img> element.

Note that the <embed> element does not have a closing tag. It can not contain alternative text.

• Example – Embed HTML:

Output:
Displays the contents of snippet.html inside a 100% wide, 500px tall embedded frame. HTML content from the file
appears as part of the current page layout.

HTML YouTube Videos


The easiest way to play videos in HTML is to use YouTube.

Struggling with Video Formats?


Converting formats can be hard and time-consuming. YouTube simplifies this by letting you embed videos directly.
YouTube Video ID
YouTube gives each video a unique ID (like tgbNymZ7vqy). Use it in your embed code.

Playing a YouTube Video in HTML


Steps:
o Upload to YouTube
o Copy the video ID
o Use an <iframe> Output:
o Set src, width, and height A 420x315 YouTube video player with full controls.
o Add any needed parameters

Example

YouTube Autoplay + Mute


To autoplay, use autoplay=1. Most browsers require mute=1 for autoplay to work. Output:
Video starts playing automatically
with no sound.

YouTube Playlist + Loop


Use loop=1 and playlist=VideoID to repeat video.

Output:
Video loops endlessly after finishing.

YouTube Controls Output:


Video plays without visible controls (no
play/pause buttons).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy