Page 163 - Web Applications (803) Class 12
P. 163
Other Methods
Source Tag
Media components like “video”, “audio” and “image” can have numerous media resources specified using the
<source> tag. The <source> element enables you to specify alternative video, audio, or image files from
which the browser may select depending on browser support or width. First supported source will be picked
by the browser.
Example:
<audio controls>
<source src=”A1.ogg” type=”audio/ogg”>
<source src=”A1.mp3” type=”audio/mpeg”>
</audio>
Embed Tag
Using the <embed> tag to insert audio into a webpage is an old method. Although this strategy works, it
is not as effective as the others. Since the embed element needs a plugin for support, add the pluginspage
attribute so that users who don’t have the right plugin for your sound file may download it.
Example:
<embed height=”250” src=”file.mp3” loop=”true” autostart=”FALSE” width=”250”
PLUGINSPAGE=”http://www.apple.com/quicktime/download/win.html”>
</embed>
Object Tag
The <object> tag specifies a container for an external resource. An image, a media player, a web page, or a
plug-in application can all be considered external resources.
Example:
<object data= “music.mp3” height=”100” width=”250”>
</object>
Sound Hosting Site
Using a sound hosting platform, like Mixcloud or SoundCloud, makes it simple to embed audio on a website.
All you have to do is upload the file to get an embed code for HTML. The embed code should then be copied
and pasted into the website’s code or WYSIWYG site editor. The majority of CMS platforms and website
builders support this.
Embedding Audio Through a Helper Application
Follow this format if you want to play an audio on your website:
<A HREF=”music.wav”> Click Here to play the Audio </A>
As you can note, it’s just a straightforward link that directs you to the sound file. The browser will handle
playing the sound file if you put it in the same directory as the page that uses it. However, the user accessing
the page on the website must have the proper helper application to play the sound file. (Plug-ins are programs
that may be incorporated to a web browser when it launches (thus, the term plug-in). Helper apps are
independent software that web browsers may employ to interact with particular sorts of files. By “plugging
in,” plug-ins extend the functionality of a web browser.
Customising and Embedding Multimedia Components in Web Pages 161

