Adding Video with the img Element’s dynsrc Property
Users can tremendously enhance the multimedia presentations by incorporating a variety of video formats into their Web pages. The img element (introduced in Chapter 4) incor-porates both images and videos in a Web page. The src property, shown previously, indi-cates that the source is an image. The dynsrc (i.e., dynamic source) property indicates that the source is a video clip. The dynsrc property may have other properties such as loop, which is similar to the bgsound loop property. The XHTML document of Fig. 33.2 demonstrates the img element and its dynsrc property.
<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<!-- Fig. 33.2: Dynamicimg.html -->
<!-- Demonstrating the img element’s dynsrc property -->
<html xmlns = "http://www.w3.org/1999/xhtml">
<title>An Embedded Video Using the dynsrc Property</title>
<bgsound src =
loop = "-1"></bgsound>
<h1>An Embedded Video Using the img element's
<h2>Car and Carribean Music</h2>
<tr><td><img dynsrc = "car_hi.wmv"
start = "mouseover" width = "180"
height = "135" loop = "-1"
alt = "Car driving in circles" /></td>
<td>This page will play the audio clip and video
in a loop.<br />The video will not begin
playing until you move the mouse over the
video.<br />Press <strong>Stop</strong> to
stop playing the sound and the video.</td>
Fig. 33.2 Playing a video with the img element’s dynsrc property
The img element in lines 21–24 uses the dynsrc property to load and display the video car_hi.wmv. Property start specifies when the video should start playing. There are two possible start events—fileopen indicates that the video should play as soon as it loads into the browser, and mouseover indicates that the video should play when users first position the mouse over the video.
Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.