Media
01/08/2009 17:43
Introduction to Web Multimedia
Multimedia is pictures, sounds, music, animations and videos.
Modern web browsers have support for many multimedia formats.
What is Multimedia?
Multimedia is everything you can hear or see: texts, books, pictures, music, sounds, CDs, videos, DVDs, Records, Films, and more.
Multimedia comes in many different formats. On the Internet you will find many of these elements embedded in web pages, and today's web browsers have support for a number of multimedia formats.
In this tutorial you will learn about different multimedia formats and how to use them in your web pages.
Browser Support
The first Internet browsers had support for text only, and even the text support was limited to a single font in a single color, and little or nothing else.
Then came web browsers with support for colors, fonts and text styles, and the support for pictures was added.
The support for sounds, animations and videos is handled in different ways by different browsers. Some elements can be handled inline, some requires a plug-in and some requires an ActiveX control.
You will learn more about this in the next chapters.
Multimedia Formats
Multimedia elements (like sounds or videos) are stored in media files.
The most common way to discover the media type is to look at the file extension.
When a browser sees the file extensions .htm or .html, it will assume that the file is an HTML page. The .xml extension indicates an XML file, and the .css extension indicates a style sheet.
Picture formats are recognized by extensions like .gif and .jpg.
Multimedia elements also have their own file formats with different extensions.
You will learn more about media file extensions in the next chapters.
Multimedia Sound Formats
Sound can be stored in many different formats.
The MIDI Format
The MIDI (Musical Instrument Digital Interface) is a format for sending music information between electronic music devices like synthesizers and PC sound cards.
The MIDI format was developed in 1982 by the music industry. The MIDI format is very flexible and can be used for everything from very simple to real professional music making.
MIDI files do not contain sampled sound, but a set of digital musical instructions (musical notes) that can be interpreted by your PC's sound card.
The downside of MIDI is that it cannot record sounds (only notes). Or, to put it another way: It cannot store songs, only tunes.
Click here to play The Beatles.
The upside of the MIDI format is that since it contains only instructions (notes), MIDI files can be extremely small. The example above is only 23K in size but it plays for nearly 5 minutes.
The MIDI format is supported by many different software systems over a large range of platforms. MIDI files are supported by all the most popular Internet browsers.
Sounds stored in the MIDI format have the extension .mid or .midi.
The RealAudio Format
The RealAudio format was developed for the Internet by Real Media. The format also supports video.
The format allows streaming of audio (on-line music, Internet radio) with low bandwidths. Because of the low bandwidth priority, quality is often reduced.
Sounds stored in the RealAudio format have the extension .rm or .ram.
The AU Format
The AU format is supported by many different software systems over a large range of platforms.
Sounds stored in the AU format have the extension .au.
The AIFF Format
The AIFF (Audio Interchange File Format) was developed by Apple.
AIFF files are not cross-platform and the format is not supported by all web browsers.
Sounds stored in the AIFF format have the extension .aif or .aiff.
The SND Format
The SND (Sound) was developed by Apple.
SND files are not cross-platform and the format is not supported by all web browsers.
Sounds stored in the SND format have the extension .snd.
The WAVE Format
The WAVE (waveform) format is developed by IBM and Microsoft.
It is supported by all computers running Windows, and by all the most popular web browsers.
Sounds stored in the WAVE format have the extension .wav.
The MP3 Format (MPEG)
MP3 files are actually MPEG files. But the MPEG format was originally developed for video by the Moving Pictures Experts Group. We can say that MP3 files are the sound part of the MPEG video format.
MP3 is one of the most popular sound formats for music recording. The MP3 encoding system combines good compression (small files) with high quality. Expect all your future software systems to support it.
Sounds stored in the MP3 format have the extension .mp3, or .mpga (for MPG Audio).
What Format To Use?
The WAVE format is one of the most popular sound format on the Internet, and it is supported by all popular browsers. If you want recorded sound (music or speech) to be available to all your visitors, you should use the WAVE format.
The MP3 format is the new and upcoming format for recorded music. If your website is about recorded music, the MP3 format is the choice of the future.
Multimedia Video Formats
Video can be stored in many different formats.
The AVI Format
The AVI (Audio Video Interleave) format was developed by Microsoft.
The AVI format is supported by all computers running Windows, and by all the most popular web browsers. It is a very common format on the Internet, but not always possible to play on non-Windows computers.
Videos stored in the AVI format have the extension .avi.
The Windows Media Format
The Windows Media format is developed by Microsoft.
Windows Media is a common format on the Internet, but Windows Media movies cannot be played on non-Windows computer without an extra (free) component installed. Some later Windows Media movies cannot play at all on non-Windows computers because no player is available.
Videos stored in the Windows Media format have the extension .wmv.
The MPEG Format
The MPEG (Moving Pictures Expert Group) format is the most popular format on the Internet. It is cross-platform, and supported by all the most popular web browsers.
Videos stored in the MPEG format have the extension .mpg or .mpeg.
The QuickTime Format
The QuickTime format is developed by Apple.
QuickTime is a common format on the Internet, but QuickTime movies cannot be played on a Windows computer without an extra (free) component installed.
Videos stored in the QuickTime format have the extension .mov.
The RealVideo Format
The RealVideo format was developed for the Internet by Real Media.
The format allows streaming of video (on-line video, Internet TV) with low bandwidths. Because of the low bandwidth priority, quality is often reduced.
Videos stored in the RealVideo format have the extension .rm or .ram.
The Shockwave (Flash) Format
The Shockwave format was developed by Macromedia.
The Shockwave format requires an extra component to play. This component comes preinstalled with the latest versions of Netscape and Internet Explorer.
Videos stored in the Shockwave format have the extension .swf.
Playing Sounds On The Web
Sounds can be played "inline" or by a "helper", depending on the HTML element you use.
Inline Sound
When sound is included in a web page, or as part of a web page, it is called inline sound.
Inline sound can be added to a web page by using the <bgsound> element or the <img> element.
If you plan to use inline sounds in your web applications, be aware that many people find inline sound annoying. Also note that some users might have turned off the inline sound option in their browser.
Our best advice is to include inline sound only in web pages where the user expects to hear the sound. An example of this is a page which opens after the user has clicked on a link to hear a recording.
Using A Helper (Plug-In)
A helper application is a program that can be launched by the browser to "help" playing sound. Helper applications are also called Plug-Ins.
Helper applications can be launched using the <embed> element, the <applet> element, or the <object> element.
One great advantage of using a helper application is that you can let some (or all) of the player settings be controlled by the user.
Most helper applications allows manually (or programmed) control over the volume settings and play functions like rewind, pause, stop and play.
Using The <bgsound> Element
Internet Explorer supports an element called <bgsound>.
The purpose of this element is to provide a background sound for a web page:
|
The code fragment above displays a MIDI file as background music for a web page.
A list of attributes for the <bgsound> element can be found in a later chapter of this tutorial.
Note: The <bgsound> element is not a standard HTML or XHTML element. It is supported by Internet Explorer only.
Using The <img> Element
Internet Explorer supports the dynsrc attribute in the <img> element.
The purpose of this element is to embed multimedia elements in web page:
|
The code fragment above displays a WAVE file embedded in a web page.
Note: The dynsrc attribute is not a standard HTML or XHTML attribute. It is supported by Internet Explorer only.
Using The <embed> Element
Internet Explorer and Netscape both support an element called <embed>.
The purpose of this element is to embed multimedia elements in web page:
|
The code fragment above displays a MIDI file embedded in a web page.
A list of attributes for the <embed> element can be found in a later chapter of this tutorial.
Note: The <embed> element is supported by both Internet Explorer and Netscape, but it is not a standard HTML or XHTML element. The World Wide Web Consortium (W3C) recommend using the <object> element instead.
Using The <object> Element
Internet Explorer and Netscape both support an HTML element called <object>.
The purpose of this element is to embed multimedia elements in web page:
|
The code fragment above displays a WAVE file embedded in a web page.
A list of attributes for the <object> element can be found in a later chapter of this tutorial.
Using A Hyperlink
If a web page includes a hyperlink to a media file, most browsers will use a "helper application" to play the file:
Click here to play the Beatles |
The code fragment above displays a link to a MIDI file. If the user clicks on the link, the browser will launch a helper application like Windows Media Player to play the MIDI file.
Playing Videos On The Web
Videos can be played "inline" or by a "helper", depending on the HTML element you use.
Inline Videos
When a video is included in a web page it is called inline video.
Inline video can be added to a web page by using the <img> element.
If you plan to use inline videos in your web applications, be aware that many people find inline videos annoying. Also note that some users might have turned off the inline video option in their browser.
Our best advice is to include inline videos only in web pages where the user expects to see a video. An example of this is a page which opens after the user has clicked on a link to see the video.
Using A Helper (Plug-In)
A helper application is a program that can be launched by the browser to "help" playing a video. Helper applications are also called Plug-Ins.
Helper applications can be launched using the <embed> element, the <applet> element, or the <object> element.
One great advantage of using a helper application is that you can let some (or all) of the player settings be controlled by the user.
Most helper applications allow manual (or programmed) control over the volume settings and play functions like rewind, pause, stop and play.
Using The <img> Element
Internet Explorer supports the dynsrc attribute in the <img> element.
The purpose of this element is to embed multimedia elements in web page:
|
The code fraction above displays an AVI file embedded in a web page.
Note: The dynsrc attribute is not a standard HTML or XHTML attribute. It is supported by Internet Explorer only.
Using The <embed> Element
Internet Explorer and Netscape both support an element called <embed>.
The purpose of this element is to embed multimedia elements in web page:
|
The code fraction above displays an AVI file embedded in a web page.
A list of attributes for the <embed> element can be found in a later chapter of this tutorial.
Note: The <embed> element is supported by both Internet Explorer and Netscape, but it is not a standard HTML or XHTML element. The World Wide Web Consortium (W3C) recommend using the <object> element instead.
Using The <object> Element
Internet Explorer and Netscape both support an HTML element called <object>.
The purpose of this element is to embed multimedia elements in web page:
|
The code fraction above displays an AVI file embedded in a web page.
A list of attributes for the <object> element can be found in a later chapter of this tutorial.
Using A Hyperlink
If a web page includes a hyperlink to a media file, most browsers will use a "helper application" to play the file:
Click here to play a video file |
The code fraction above displays a link to an AVI file. If the user clicks on the link, the browser will launch a helper application like Windows Media Player to play the AVI file.
Windows Multimedia Formats
Windows media files have the extensions: .asf, .asx, .wma, and .wmv.
The ASF Format
The ASF format (Advanced Streaming Format) is specially designed to run over the Internet.
ASF files can contain audio, video, slide shows, and synchronized events.
ASF files can be highly compressed and can be delivered as a continuous flow of data (on-line TV or radio). Files can be of any size, and can be compressed to match many different bandwidths (connection speeds).
The ASX Format
ASX (Advanced Stream Redirector) files are not media files, but metafiles.
Metafiles provides information about files. ASX files are plain text files used to describe multimedia content:
<ref href="holiday-1.avi"/>
<ref href="holiday-2.avi"/>
<ref href="holiday-2.avi"/>
|
The file above describes three multimedia files. When the ASX file is read by a player, the player can play the files described.
The WMA Format
The WMA (Windows Media Audio) format is an audio format developed by Microsoft.
WMA is designed to handle all types of audio content. The files can be highly compressed and can be delivered as a continuous flow of data (on-line radio). WMA files can be of any size, and be compressed to match many different bandwidths (connection speeds).
The WMA format is similar to the ASF format (see above)
The WMV Format
The WMV (Windows Media Video) format is a video format developed by Microsoft.
WMV is designed to handle all types of video content. The files can be highly compressed and can be delivered as a continuous flow of data (on-line radio). WMV files can be of any size, and be compressed to match many different bandwidths (connection speeds).
The WMV format is similar to the ASF format (see above)
Other Windows Media Formats
WAX (Windows Media Audio Redirector) files are much the same as ASX files, but intended to describe audio files (.wma files)
WMP (Windows Media Player) files and WMX are reserved file types for future use by Windows.
The Object Element
The <object> element can support many different media types, like: · Pictures · Sounds · Videos · Other Objects |
Displaying A Picture
You can display a picture:
|
Displaying A Web Page
You can display a web page:
|
Displaying A Sound
You can display a sound:
|
Displaying A Video
You can display a video:
|
Displaying A Calendar
You can display a calendar:
|
Displaying Graphics
You can display graphics:
|
Displaying Flash
You can display a flash animation:
|
Playing QuickTime Movies
The <object> element can play QuickTime movies.
The QuickTime Format
The QuickTime format is developed by Apple. Videos stored in the QuickTime format have the extension .mov.
QuickTime is a common format on the Internet, but QuickTime movies cannot be played on a Windows computer without an extra (free) component installed.
With the object element, code that will play a QuickTime movie can easily be added to a web page. The object can be set to automatically install a QuickTime player if it is not already installed on the users computer.
The Solution
This is the code required to play a QuickTime movie:
|
The <object> Element
The width and height attributes of the object element should match the size of the movie in pixels.
The classid attribute uniquely identifies the player software to use. It must be set to "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B". This unique code identifies an ActiveX control that must be installed on the users PC before the movie can be played. If the user does not have the ActiveX control installed, the browser can automatically download and install it.
The codebase attribute specifies the base path used to resolve relative URIs specified by the classid, data, and archive attributes. When absent, its default value is the base URI of the current document. Note: Internet Explorer uses this attribute to specify a location from where the player can be downloaded. It must be set to "https://www.apple.com/qtactivex/qtplugin.cab". This location will always contain the latest version of the QuickTime player.
The src parameter should point to the movie file.
The autoplay parameter should have the value "true" if you want the movie to play automatically.
The controller parameter should have the value "false" if you don't want the control buttons to show.
The <embed> Element
The embed element is added to support browsers that don't support the object element. A browser that understands the object element will ignore the embed element. The object element will be used by new browsers that support ActiveX controls (Internet Explorer 5 and 6). Older browsers (Netscape 4 and 5) will use the embed element.
The width and height attributes of the embed element should match the size of the movie in pixels.
The autoplay and controller attributes of the embed element should be set to the same values as for the parameters in the object element.
The pluginspage attribute defines the players download path. It must be set to "https://www.apple.com/quicktime/download/".
Playing Real Video Movies
The <object> element can play Real Video movies.
The Real Video Format
The RealVideo format is developed by Real Media. Videos stored in the Real Video format have the extension .rm or .ram.
The format allows streaming of video (on-line video, Internet TV) with low bandwidths. Because of the low bandwidth priority, quality is often reduced.
The Solution
This is the code required to play a Real Video movie:
|
The <object> Element
The width and height attributes of the object element should match the size of the movie in pixels.
The classid attribute uniquely identifies the player software to use. It must be set to "clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA". This unique code identifies an ActiveX control that must be installed on the users PC before the movie can be played. If the user does not have the ActiveX control installed, the browser can automatically download and install it.
The param elements supply additional information to the player.
The src parameter should point to the movie (or audio) file.
The autostart parameter should have the value "true" if you want the movie to play automatically.
The controls parameter should have the value "ImageWindow" if you don't want the control buttons to show, or "All" if you want all the controls to show.
Object Reference
Attribute |
Defines |
classid |
A unique id for the object. |
height |
The height of the object in pixels or %. |
width |
The width of the object in pixels or in %. |
Parameter Reference
Attribute |
Defines |
src |
The source of a RealAudio or RealVideo clip. |
controls |
The visibility of the controls. (See below) |
console |
A console name to link multiple controls. |
autostart |
Automatic start. (true | false). |
nolabels |
Suppression of label texts in the controls window. |
reset |
Resetting the control for playlist. (true | false). |
autogotoURL |
How a URL is handled. (true | false) |
Controls Values
Value |
Displays |
All |
Displays a full player with all controls. |
InfoVolumePanel |
Title, author, and copyright and volume slider. |
InfoPanel |
Title, author, and copyright. |
ControlPanel |
Position slider, play, pause, and stop buttons. |
StatusPanel |
Messages, current time position, and clip length. |
PlayButton |
Play and pause buttons. |
StopButton |
Stop button. |
VolumeSlider |
Volume slider. |
PositionField |
Position and clip length. |
StatusField |
Messages. |
ImageWindow |
The video image |
StatusBar |
Status, position and channels. |
Web Multimedia Element Reference
The <bgsound> Element
Attribute |
Function |
id |
A unique id for the element. |
src |
The location (URL) of the source file. |
balance |
The balance. (-10000=left, +10000=right). |
loop |
The number of loops. (-1=infinite). |
volume |
The volume. (0=max, -10000=min). |
The <embed> Element
Attribute |
Defines |
autostart |
Automatic start. (true | false). |
height |
The height of the element in pixels or %. |
hidden |
The visibility of the element. (true | false). |
src |
The location (URL) of the source file. |
width |
The width of the element in pixels or %. |
See also styling attributes, common HTML attributes and Event attributes at the bottom of this page.
The <applet> Element
Attribute |
Defines |
alt |
An alternate text. |
archive |
The locations (URLs) of archive files. |
code |
The location (URL) of the applet code. |
codebase |
The base location (default URL) for all files. |
height |
The height of the applet in pixels or %. |
name |
The name of the applet. |
object |
A saved representation of the applet. Do not use. |
width |
The width of the applet in pixels or %. |
See also styling attributes, common HTML attributes and Event attributes at the bottom of this page.
The <object> Element
Attribute |
Defines |
archive |
The locations (URLs) of archive files. |
classid |
The location (URL) of the object. |
codebase |
The base path used to resolve relative URIs specified by the classid, data, and archive attributes. |
codetype |
The content type of the code. |
data |
The location (URL) of object data. |
declare |
Do not instantiate (execute) the object. |
height |
The height of the object in pixels or %. |
name |
The object's name. |
standby |
Text to display while object is loading. |
tabindex |
The position in the tab order |
type |
The content type of the object. |
usemap |
The location (URL) of an image map. |
width |
——— Back |