HTML and CSS Reference
In-Depth Information
The following sections illustrate how to use the <object> tag to play audio and video files.
Embedding Audio Files
To embed an audio file into a web page, you can use an <object> tag as shown in Listing 3-1.
Listing 3-1. Using the <object> Tag to Play Audio Files
<h2>Play Audio File</h2>
<object data="Media/Song.mp3" />
The data attribute of the <object> tag points to an MP3 audio file residing in the Media folder.
Embedding Flash Video Files
Adobe Flash is one of the most popular ways of embedding video files in web pages. Due to its popularity,
all the leading browsers support the Flash plug-in. You can use the <object> tag to embed Flash videos in a
web page; Listing 3-2 shows how.
Listing 3-2. Embedding a Flash Video Using the <object> Ta g
<object id="lash1" data="Media/Video1.swf" type="application/x-shockwave-lash"
height="200" width="200">
<param name="movie" value="Media/Video1.swf">
The <object> tag this time plays a Flash video file Video1.swf . The type attribute specifies the MIME
type for Flash videos ( (application/x-shockwave-flash). ).
Embedding Silverlight Video Files
Microsoft's solution to displaying media files in a web page is Silverlight. Silverlight is seen as a competitor
to Flash, but because it's a relatively recent invention, it lags behind Flash in terms of popularity and
widespread use. However, Silverlight is a flexible and powerful platform that can be programmed using
.NET tools such as Visual Studio and Visual C#. You can also encode existing media files into a Silverlight-
specific format using Expression Web. Listing 3-3 shows how to embed and play a video using Silverlight.
Listing 3-3. Embedding Silverlight Media Files
<object data="data:application/x-silverlight-2"
type="application/x-silverlight-2" width="300" height="300">
<param name="source" value="silverlightvideos/CleanTemplate.xap"/>
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50401.0" />
<param name="autoUpgrade" value="true" />
<param name="enableHtmlAccess" value="true" />
<param name="enableGPUAcceleration" value="true" />
<param name="initparams" value='playerSettings =
Search WWH ::

Custom Search