SlideShare uma empresa Scribd logo
1 de 12
Baixar para ler offline
Programming and Development Tools                              Web Programming




                                                                UNIT


                                                           2.8
Web Programming
Multimedia Objects




 OBJECTIVES
 This unit helps you to attract the users by adding Multimedia objects.
 At the end of this unit, you will be able to
             Add background music to your Web pages.
             Add movies to your Web pages.
             Add Animation to your Web pages.




Benchmark standard
           Create Web pages that contain audio, movie and animation.




Multimedia Objects                                                        2.8-1
Programming and Development Tools                              Web Programming




Let us Revise!

 I. Answer the following questions:
    1. Write how you will insert images in your Web page.
    2. Name the attributes that are used to change the size of the image in a
       Web page.
    3. Describe how you will convert an image to a hyperlink.
    4. Define Image Map.
    5. Write the tag and attribute used to display an image as the background
       of a Web page?


 Introduction
 The Web pages that you design must invite the users. The Web pages can be
 enhanced by adding Multimedia objects. Multimedia objects are the objects
 that enable the user to listen to music, watch movie, enjoy animation and
 much more. Adding music, movie and animation to your Web pages is very
 simple. These multimedia objects can be added to the Web pages using the
 <EMBED> tag along with Src attribute.


 2.8.1 Music
 To add a flavour to your HTML Web pages, you can add background music to
 them. The user can browse your Web page enjoying the background music.



      Hands-On!

 The following example illustrates how to add music in your Web page.
 Open the HTML file Music.html in Internet Explorer.
 The code in Music.html file is given below:
 <HTML>
 <HEAD>
 <TITLE> Music </TITLE>
 </HEAD>
 <BODY Bgcolor="Firebrick" Text="Lightyellow">
 <FONT Size=7>
 <H1 Align="Center"> National Anthem </H1>
 <CENTER><IMG Src="Mal_Flag.gif"><BR><BR>

 Multimedia Objects                                                      2.8-2
Programming and Development Tools                Web Programming


<EMBED Src="National_Anthem.wav"></CENTER>
<BR>
<MARQUEE BGColor="Black" Loop=1>
Negaraku -
Tanah tumpahnya darahku -
Rakyat hidup -
Bersatu dan Maju -
Rahmat Bahagia -
Tuhan kurniakan -
Raja Kita -
Selamat bertahta.
Rahmat Bahagia -
Tuhan kurniakan -
Raja Kita -
Selamat bertahta.
</MARQUEE>
</BODY>
</HTML>
                             Code Sample 2.8.1




Multimedia Objects                                        2.8-3
Programming and Development Tools                                Web Programming




                     Figure 2.8.1: A Web page with Music
When you open the Web page shown in Figure 2.8.1 in a browser, you can
see the text of our National Anthem scrolling across the screen and hear to
the National Anthem. The tag that is used to execute sound files is <EMBED>
tag. Src is the attribute used along with this tag. The name of the sound file is
assigned to the Src attribute. You heard a wonderful music while opening the
above Web page because of the following tag:
<EMBED Src=”National_Anthem.wav”>

The attributes that can be used along with <EMBED> tag are explained in
Table 2.8.1.




Multimedia Objects                                                         2.8-4
Programming and Development Tools                               Web Programming




         Attribute                   Use                    Example
            Src             Specifies the name        <EMBED
                            of the sound file         Src=”flourish.mid”>

          AutoStart         Specifies whether    <EMBED
                            the sound should be Src=”flourish.mid”
                            played automatically Autostart=True>
                            or not.

            Loop            Specifies whether       <EMBED
                            the music should be Src=”flourish.mid”
                            played indefinitely     Loop=True>
                            or only once. If the
                            value assigned is
                            true, it will be played
                            indefinitely.
                            Otherwise, it will be
                            played only once.
            Width           Specifies the width   <EMBED
                            of the sound control. Src=”flourish.mid”
                                                  Width=”45”>

           Height           Specifies the height <EMBED
                            of the sound control. Src=”flourish.mid”
                                                  Height=”30”>


                     Table 2.8.1: Attributes of <EMBED> Tag

For example, the following code plays the MIDI file (Sound file) indefinitely.
The height and width of the sound control would be 20 and 30 respectively.
<EMBED Src=”flourish.mid” Loop=True Height=”20”
Width=”30”>

        Note

<BGSOUND> tag can also be used to play sound files.




Multimedia Objects                                                        2.8-5
Programming and Development Tools                                           Web Programming




        Lab Exercise
Lab Exercise 1: Open D8_1.html in Internet Explorer. The following code will be present in
D8_1.html.
<HEAD>
<TITLE> Music </TITLE>
</HEAD>
<BODY BGCOLOR ="#FFE4B5" >
       <FONT SIZE=24 COLOR="#008000">
       <MARQUEE> HAPPY BIRTHDAY </MARQUEE><BR><BR>
       <CENTER>
                <IMG SRC="CAKE.BMP"> <BR><BR>
                <EMBED Src="HAPPY_BIRTHDAY.MID" LOOP=FALSE
                HEIGHT=20 WIDTH=30>
       </CENTER>
       </FONT>
</BODY>
</HTML>
   1. Identify the tag which is used to add the sound in source code D8_1.html.
   2. Locate the attribute which is used to assign the sound file.
   3. Name the value of the loop attribute which is used to play the music only once.
   4. Identify the value of the autostart attribute which is used to play the music
       automatically.

Lab Exercise 2: Open D8_1.html in Internet Explorer.
    1. View the code in Notepad.
    2. Set the Loop attribute value to True and observe the difference.
    3. Set the Autostart attribute value to False and observe the difference.


2.8.2 Movies
Adding movies to your Web page is as simple as adding music to your Web
page.



      Hands-On!

The following example illustrates how to add movies in your Web page.
Open the HTML file Movie.html in Internet Explorer.
The code in Movie.html file is given below:
<HTML>
<HEAD>
<TITLE> Movie </TITLE>
</HEAD>


Multimedia Objects                                                                    2.8-6
Programming and Development Tools                             Web Programming


<BODY>
<EMBED Src="Movie1.avi" Height="150" Width="150"
Autostart="False" Loop="True" Controller="True">
</BODY>
</HTML>
                              Code Sample 2.8.2


When you open the above HTML file in a browser, you can see a control that
plays the movie. The tag that is used to add movies is <EMBED> tag. Src is the
attribute used along with this tag. The name of the movie file is assigned to
the Src attribute. The following tag adds a movie to a Web page:
<EMBED Src=”Movie1.avi”>




2.8.3 Animation
Animation attracts the users of all age. You can attract the users by adding
animations in your Web pages. Animations created in SWF (Shock Wave File)
format using Flash, a Multimedia Software, can be embedded in a HTML
document.

     Hands-On!

The following example illustrates how to add animation in your Web page.
Open the HTML file Animation.html in Internet Explorer.
The code in Animation.html file is given below:
<HTML>
<HEAD>
<TITLE> Animation </TITLE>
</HEAD>
<BODY> <FONT Size="6">
<H1 Align="Center"> Man Proposes God Disposes </H1>
<EMBED Src="C:HTMLUnit 8Hands onAnimation.swf"
Align="Left" Height="500" Width="680">
<CENTER><BR><BR><BR><BR>All our disastrous desires are
disposed by God <CENTER>
</BODY>
</HTML>
                              Code Sample 2.8.3

Multimedia Objects                                                      2.8-7
Programming and Development Tools                                          Web Programming




The Web page shown in Figure 2.8.2 is displayed.




                      Figure 2.8.2: A Web page with a movie
When you open the above HTML file in a browser, you can see a control that
plays the Flash animation. The tag that is used to add animations is <EMBED>
tag. Src is the attribute used along with this tag. The name of the animation file
is assigned to the Src attribute. The following tag is used to add an animation
to a Web page:
<EMBED Src=”Animation.swf”>
where Animation.swf is the name of the flash animation file.


        Lab Exercise

Lab Exercise 3: Write a HTML code to display the output as given in the following Figure 2.8.3
using <EMBED> tag. The text shown in the Web page should display in center of the
animation.




Multimedia Objects                                                                     2.8-8
Programming and Development Tools                                          Web Programming




                                Figure 2.8.3: Animation
Lab Exercise 4: Write a HTML code to display the output as given in the following Figure 2.8.4
using <EMBED> tag.




                                Figure 2.8.4: Animation

Multimedia Objects                                                                     2.8-9
Programming and Development Tools                                           Web Programming




       Self-Check Exercise 2.8.1
   1. Write the tag to play the music file Song.wav only once in a Web page.
   2. Write the tag to play the movie file Clock.avi in a Web page.
   3. Write the tag to play the animation file Cartoon.swf in a Web page.



     Activity 2.8.1

   1. Create a Web page that explains how to add multimedia objects in a
      Web page as shown in Figure 2.8.5
   2. Save the HTML file as Activity1.html.




          Figure 2.8.5: A Web page explaining Multimedia Objects


Technical Terminologies
Multimedia - Multimedia is an integration of various media elements such as
             audio, video, text and images.
Animation - Animation is a technique of producing continuous movement
             using series of images.
Movie      - It is a continuous sequence of video frames that are displayed
             in series to illusion of motion.


Multimedia Objects                                                                   2.8-10
Programming and Development Tools                           Web Programming



Summary
In this unit, you learnt that
           The multimedia objects can be added to the Web pages using the
           <EMBED> tag along with Src attribute.
           Autostart attribute of <EMBED> tag specifies whether the sound
           should be played automatically or not.
           Animations created in SWF format using Flash, a Multimedia
           Software, can be embedded in a HTML document.



Assignment

I. Answer the following questions:
   1. Name the tag and attribute used to add music to a Web page.
   2. Name any 3 attributes of <EMBED> tag and state their function.
   3. Write briefly how will you add a movie and animation to a Web page.




Multimedia Objects                                                     2.8-11
Programming and Development Tools                             Web Programming



Criterion - Referenced Test
Instruction: Students must evaluate themselves to attain the list of
             competencies to be achieved.

Name:
Subject:       Programming and Development Tools
Unit:          Multimedia Objects

Please tick [ √ ] the appropriate box when you have achieved the respective
competency.

    Date                            Multimedia Objects
                 C1 C2 C3




Comment



Competency codes:


C1 = Write a program to add a music to a Web page.
C2 = Write a program to add a movie to a Web page.
C3 = Write a program to add an animation to a Web page.




Multimedia Objects                                                     2.8-12

Mais conteúdo relacionado

Destaque

Convergence in media
Convergence in mediaConvergence in media
Convergence in media
Yogesh Sahu
 
Communication devices
Communication devicesCommunication devices
Communication devices
haider ali
 
Importance of Multimedia
Importance of MultimediaImportance of Multimedia
Importance of Multimedia
Saíful Íslam
 
Multimedia software tools
Multimedia software toolsMultimedia software tools
Multimedia software tools
Jay Patel
 
Ordered & unordered list in MS Frontpage 2003
Ordered & unordered list in MS Frontpage 2003Ordered & unordered list in MS Frontpage 2003
Ordered & unordered list in MS Frontpage 2003
Ann Alcid
 
Communication devices
Communication devicesCommunication devices
Communication devices
har139
 
Communication System Devices
Communication System DevicesCommunication System Devices
Communication System Devices
Jason Hando
 

Destaque (20)

Convergence in media
Convergence in mediaConvergence in media
Convergence in media
 
Html list
Html listHtml list
Html list
 
Ordered lists
Ordered listsOrdered lists
Ordered lists
 
Working with HTML Lists
Working with HTML ListsWorking with HTML Lists
Working with HTML Lists
 
Multimedia introduction
Multimedia introductionMultimedia introduction
Multimedia introduction
 
Multimedia Object - Image
Multimedia Object - ImageMultimedia Object - Image
Multimedia Object - Image
 
Multimedia
MultimediaMultimedia
Multimedia
 
Communication and Entertainment
Communication and EntertainmentCommunication and Entertainment
Communication and Entertainment
 
Communication devices
Communication devicesCommunication devices
Communication devices
 
What is Multimedia?.pptx
What is Multimedia?.pptxWhat is Multimedia?.pptx
What is Multimedia?.pptx
 
Importance of Multimedia
Importance of MultimediaImportance of Multimedia
Importance of Multimedia
 
Multimedia software tools
Multimedia software toolsMultimedia software tools
Multimedia software tools
 
Html ordered lists
Html ordered listsHtml ordered lists
Html ordered lists
 
Ordered & unordered list in MS Frontpage 2003
Ordered & unordered list in MS Frontpage 2003Ordered & unordered list in MS Frontpage 2003
Ordered & unordered list in MS Frontpage 2003
 
Images and Lists in HTML
Images and Lists in HTMLImages and Lists in HTML
Images and Lists in HTML
 
Communication devices
Communication devicesCommunication devices
Communication devices
 
Importance of multimedia
Importance of multimediaImportance of multimedia
Importance of multimedia
 
Multimedia Hardware
Multimedia HardwareMultimedia Hardware
Multimedia Hardware
 
Communication System Devices
Communication System DevicesCommunication System Devices
Communication System Devices
 
Multimedia data and file format
Multimedia data and file formatMultimedia data and file format
Multimedia data and file format
 

Semelhante a Unit 2.8 Multimedia Objects

Web Directions @media 2010
Web Directions @media 2010Web Directions @media 2010
Web Directions @media 2010
Patrick Lauke
 

Semelhante a Unit 2.8 Multimedia Objects (20)

Html audio video
Html audio videoHtml audio video
Html audio video
 
Html5 game development
Html5  game developmentHtml5  game development
Html5 game development
 
Unit 2.7 Images
Unit 2.7 ImagesUnit 2.7 Images
Unit 2.7 Images
 
Lesson 6
Lesson 6Lesson 6
Lesson 6
 
HTML (part ii).pptx
HTML (part ii).pptxHTML (part ii).pptx
HTML (part ii).pptx
 
Web Directions @media 2010
Web Directions @media 2010Web Directions @media 2010
Web Directions @media 2010
 
Craft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologiesCraft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologies
 
FVCP Ad Words
FVCP Ad WordsFVCP Ad Words
FVCP Ad Words
 
Replacing flash with HTML5 and CSS3
Replacing flash with HTML5 and CSS3Replacing flash with HTML5 and CSS3
Replacing flash with HTML5 and CSS3
 
Researched Definition
Researched DefinitionResearched Definition
Researched Definition
 
Researched Definition
Researched DefinitionResearched Definition
Researched Definition
 
Elizabeth Perry: Processing programming language, part 2
Elizabeth Perry: Processing programming language, part 2Elizabeth Perry: Processing programming language, part 2
Elizabeth Perry: Processing programming language, part 2
 
'THE AGE OF DATA STREAMING' by DENIS BURYACHKOVSKY at OdessaJS'2020
'THE AGE OF DATA STREAMING' by DENIS BURYACHKOVSKY at OdessaJS'2020'THE AGE OF DATA STREAMING' by DENIS BURYACHKOVSKY at OdessaJS'2020
'THE AGE OF DATA STREAMING' by DENIS BURYACHKOVSKY at OdessaJS'2020
 
Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
UNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standardUNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standard
 
CAP 756 UNIT 1.pptx
CAP 756 UNIT 1.pptxCAP 756 UNIT 1.pptx
CAP 756 UNIT 1.pptx
 
Lab#4 html5new element
Lab#4 html5new elementLab#4 html5new element
Lab#4 html5new element
 

Mais de Intan Jameel (20)

1.3 Process and Information Layout
1.3 Process and Information Layout1.3 Process and Information Layout
1.3 Process and Information Layout
 
Unit 2.10 - Frames
Unit 2.10 - FramesUnit 2.10 - Frames
Unit 2.10 - Frames
 
M02 un11 p02
M02 un11 p02M02 un11 p02
M02 un11 p02
 
M02 un10 p02
M02 un10 p02M02 un10 p02
M02 un10 p02
 
M02 un10 p01
M02 un10 p01M02 un10 p01
M02 un10 p01
 
M02 un09 p02
M02 un09 p02M02 un09 p02
M02 un09 p02
 
M02 un09 p01
M02 un09 p01M02 un09 p01
M02 un09 p01
 
M02 un07 p02
M02 un07 p02M02 un07 p02
M02 un07 p02
 
M02 un07 p01
M02 un07 p01M02 un07 p01
M02 un07 p01
 
M02 un06 p02
M02 un06 p02M02 un06 p02
M02 un06 p02
 
M02 un06 p01
M02 un06 p01M02 un06 p01
M02 un06 p01
 
M02 un05 p02
M02 un05 p02M02 un05 p02
M02 un05 p02
 
M02 un05 p01
M02 un05 p01M02 un05 p01
M02 un05 p01
 
M02 un04 p04
M02 un04 p04M02 un04 p04
M02 un04 p04
 
M02 un04 p03
M02 un04 p03M02 un04 p03
M02 un04 p03
 
M02 un04 p02
M02 un04 p02M02 un04 p02
M02 un04 p02
 
M02 un04 p01
M02 un04 p01M02 un04 p01
M02 un04 p01
 
M02 un12 p01
M02 un12 p01M02 un12 p01
M02 un12 p01
 
M02 un11 p01
M02 un11 p01M02 un11 p01
M02 un11 p01
 
Unit 2.3 Part 1
Unit 2.3 Part 1Unit 2.3 Part 1
Unit 2.3 Part 1
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 

Unit 2.8 Multimedia Objects

  • 1. Programming and Development Tools Web Programming UNIT 2.8 Web Programming Multimedia Objects OBJECTIVES This unit helps you to attract the users by adding Multimedia objects. At the end of this unit, you will be able to Add background music to your Web pages. Add movies to your Web pages. Add Animation to your Web pages. Benchmark standard Create Web pages that contain audio, movie and animation. Multimedia Objects 2.8-1
  • 2. Programming and Development Tools Web Programming Let us Revise! I. Answer the following questions: 1. Write how you will insert images in your Web page. 2. Name the attributes that are used to change the size of the image in a Web page. 3. Describe how you will convert an image to a hyperlink. 4. Define Image Map. 5. Write the tag and attribute used to display an image as the background of a Web page? Introduction The Web pages that you design must invite the users. The Web pages can be enhanced by adding Multimedia objects. Multimedia objects are the objects that enable the user to listen to music, watch movie, enjoy animation and much more. Adding music, movie and animation to your Web pages is very simple. These multimedia objects can be added to the Web pages using the <EMBED> tag along with Src attribute. 2.8.1 Music To add a flavour to your HTML Web pages, you can add background music to them. The user can browse your Web page enjoying the background music. Hands-On! The following example illustrates how to add music in your Web page. Open the HTML file Music.html in Internet Explorer. The code in Music.html file is given below: <HTML> <HEAD> <TITLE> Music </TITLE> </HEAD> <BODY Bgcolor="Firebrick" Text="Lightyellow"> <FONT Size=7> <H1 Align="Center"> National Anthem </H1> <CENTER><IMG Src="Mal_Flag.gif"><BR><BR> Multimedia Objects 2.8-2
  • 3. Programming and Development Tools Web Programming <EMBED Src="National_Anthem.wav"></CENTER> <BR> <MARQUEE BGColor="Black" Loop=1> Negaraku - Tanah tumpahnya darahku - Rakyat hidup - Bersatu dan Maju - Rahmat Bahagia - Tuhan kurniakan - Raja Kita - Selamat bertahta. Rahmat Bahagia - Tuhan kurniakan - Raja Kita - Selamat bertahta. </MARQUEE> </BODY> </HTML> Code Sample 2.8.1 Multimedia Objects 2.8-3
  • 4. Programming and Development Tools Web Programming Figure 2.8.1: A Web page with Music When you open the Web page shown in Figure 2.8.1 in a browser, you can see the text of our National Anthem scrolling across the screen and hear to the National Anthem. The tag that is used to execute sound files is <EMBED> tag. Src is the attribute used along with this tag. The name of the sound file is assigned to the Src attribute. You heard a wonderful music while opening the above Web page because of the following tag: <EMBED Src=”National_Anthem.wav”> The attributes that can be used along with <EMBED> tag are explained in Table 2.8.1. Multimedia Objects 2.8-4
  • 5. Programming and Development Tools Web Programming Attribute Use Example Src Specifies the name <EMBED of the sound file Src=”flourish.mid”> AutoStart Specifies whether <EMBED the sound should be Src=”flourish.mid” played automatically Autostart=True> or not. Loop Specifies whether <EMBED the music should be Src=”flourish.mid” played indefinitely Loop=True> or only once. If the value assigned is true, it will be played indefinitely. Otherwise, it will be played only once. Width Specifies the width <EMBED of the sound control. Src=”flourish.mid” Width=”45”> Height Specifies the height <EMBED of the sound control. Src=”flourish.mid” Height=”30”> Table 2.8.1: Attributes of <EMBED> Tag For example, the following code plays the MIDI file (Sound file) indefinitely. The height and width of the sound control would be 20 and 30 respectively. <EMBED Src=”flourish.mid” Loop=True Height=”20” Width=”30”> Note <BGSOUND> tag can also be used to play sound files. Multimedia Objects 2.8-5
  • 6. Programming and Development Tools Web Programming Lab Exercise Lab Exercise 1: Open D8_1.html in Internet Explorer. The following code will be present in D8_1.html. <HEAD> <TITLE> Music </TITLE> </HEAD> <BODY BGCOLOR ="#FFE4B5" > <FONT SIZE=24 COLOR="#008000"> <MARQUEE> HAPPY BIRTHDAY </MARQUEE><BR><BR> <CENTER> <IMG SRC="CAKE.BMP"> <BR><BR> <EMBED Src="HAPPY_BIRTHDAY.MID" LOOP=FALSE HEIGHT=20 WIDTH=30> </CENTER> </FONT> </BODY> </HTML> 1. Identify the tag which is used to add the sound in source code D8_1.html. 2. Locate the attribute which is used to assign the sound file. 3. Name the value of the loop attribute which is used to play the music only once. 4. Identify the value of the autostart attribute which is used to play the music automatically. Lab Exercise 2: Open D8_1.html in Internet Explorer. 1. View the code in Notepad. 2. Set the Loop attribute value to True and observe the difference. 3. Set the Autostart attribute value to False and observe the difference. 2.8.2 Movies Adding movies to your Web page is as simple as adding music to your Web page. Hands-On! The following example illustrates how to add movies in your Web page. Open the HTML file Movie.html in Internet Explorer. The code in Movie.html file is given below: <HTML> <HEAD> <TITLE> Movie </TITLE> </HEAD> Multimedia Objects 2.8-6
  • 7. Programming and Development Tools Web Programming <BODY> <EMBED Src="Movie1.avi" Height="150" Width="150" Autostart="False" Loop="True" Controller="True"> </BODY> </HTML> Code Sample 2.8.2 When you open the above HTML file in a browser, you can see a control that plays the movie. The tag that is used to add movies is <EMBED> tag. Src is the attribute used along with this tag. The name of the movie file is assigned to the Src attribute. The following tag adds a movie to a Web page: <EMBED Src=”Movie1.avi”> 2.8.3 Animation Animation attracts the users of all age. You can attract the users by adding animations in your Web pages. Animations created in SWF (Shock Wave File) format using Flash, a Multimedia Software, can be embedded in a HTML document. Hands-On! The following example illustrates how to add animation in your Web page. Open the HTML file Animation.html in Internet Explorer. The code in Animation.html file is given below: <HTML> <HEAD> <TITLE> Animation </TITLE> </HEAD> <BODY> <FONT Size="6"> <H1 Align="Center"> Man Proposes God Disposes </H1> <EMBED Src="C:HTMLUnit 8Hands onAnimation.swf" Align="Left" Height="500" Width="680"> <CENTER><BR><BR><BR><BR>All our disastrous desires are disposed by God <CENTER> </BODY> </HTML> Code Sample 2.8.3 Multimedia Objects 2.8-7
  • 8. Programming and Development Tools Web Programming The Web page shown in Figure 2.8.2 is displayed. Figure 2.8.2: A Web page with a movie When you open the above HTML file in a browser, you can see a control that plays the Flash animation. The tag that is used to add animations is <EMBED> tag. Src is the attribute used along with this tag. The name of the animation file is assigned to the Src attribute. The following tag is used to add an animation to a Web page: <EMBED Src=”Animation.swf”> where Animation.swf is the name of the flash animation file. Lab Exercise Lab Exercise 3: Write a HTML code to display the output as given in the following Figure 2.8.3 using <EMBED> tag. The text shown in the Web page should display in center of the animation. Multimedia Objects 2.8-8
  • 9. Programming and Development Tools Web Programming Figure 2.8.3: Animation Lab Exercise 4: Write a HTML code to display the output as given in the following Figure 2.8.4 using <EMBED> tag. Figure 2.8.4: Animation Multimedia Objects 2.8-9
  • 10. Programming and Development Tools Web Programming Self-Check Exercise 2.8.1 1. Write the tag to play the music file Song.wav only once in a Web page. 2. Write the tag to play the movie file Clock.avi in a Web page. 3. Write the tag to play the animation file Cartoon.swf in a Web page. Activity 2.8.1 1. Create a Web page that explains how to add multimedia objects in a Web page as shown in Figure 2.8.5 2. Save the HTML file as Activity1.html. Figure 2.8.5: A Web page explaining Multimedia Objects Technical Terminologies Multimedia - Multimedia is an integration of various media elements such as audio, video, text and images. Animation - Animation is a technique of producing continuous movement using series of images. Movie - It is a continuous sequence of video frames that are displayed in series to illusion of motion. Multimedia Objects 2.8-10
  • 11. Programming and Development Tools Web Programming Summary In this unit, you learnt that The multimedia objects can be added to the Web pages using the <EMBED> tag along with Src attribute. Autostart attribute of <EMBED> tag specifies whether the sound should be played automatically or not. Animations created in SWF format using Flash, a Multimedia Software, can be embedded in a HTML document. Assignment I. Answer the following questions: 1. Name the tag and attribute used to add music to a Web page. 2. Name any 3 attributes of <EMBED> tag and state their function. 3. Write briefly how will you add a movie and animation to a Web page. Multimedia Objects 2.8-11
  • 12. Programming and Development Tools Web Programming Criterion - Referenced Test Instruction: Students must evaluate themselves to attain the list of competencies to be achieved. Name: Subject: Programming and Development Tools Unit: Multimedia Objects Please tick [ √ ] the appropriate box when you have achieved the respective competency. Date Multimedia Objects C1 C2 C3 Comment Competency codes: C1 = Write a program to add a music to a Web page. C2 = Write a program to add a movie to a Web page. C3 = Write a program to add an animation to a Web page. Multimedia Objects 2.8-12