Embedding Sound in Web Pages, Part I: The ActiveMovie Control Properties - Doc JavaScript | WebReference

Embedding Sound in Web Pages, Part I: The ActiveMovie Control Properties - Doc JavaScript


The ActiveMovie Control Properties

Internet Explorer uses the ActiveMovie Control to play sound tracks embedded in Web pages. ActiveMovie Control is a programming interface for Microsoft's DirectShow media architecture that supports many media formats and operations on them. ActiveMovie supports media tracks embedded in <EMBED>, <OBJECT>, and <IMG> HTML tags. The <OBJECT> and <IMG> HTML tags will be covered in the next column, but the ActiveMovie Control interface explained in this and following pages applies to them as well. Although ActiveMovie Control supports many media formats, this column deals only with the audio ones.

The ActiveMovie Control programming interface includes control properties, methods, events, property sheet, and shortcut keys. Their names are case-insensitive, so, for example, all the following methods will stop a playing sound track: Stop(), stop(), sTop(), and stoP().The following table summarizes the control object properties, accessible by JavaScript:

PropertyDescription
AllowChangeDisplayMode = true | falseSpecifies whether or not the user can change the display panel to show frames instead of seconds. Default is true.
AllowHideControls = true | falseSpecifies whether or not the user can hide the control panel at run time. Default is true.
AllowHideDisplay = true | falseSpecifies whether or not the user can hide the display panel at run time. Default is true.
Appearance = 0 | 1Specifies the appearance of the display panel border. Appearance = 1 specifies an inset border which gives the illusion of depth. Appearance = 0 indicates the display panel has no border. Default is 1.
AutoRewind = true | falseSpecifies whether or not to rewind the sound track to the initial position. Default is true.
Balance = nSpecifies the stereo balance. Ranges between -10000 (left channel only), through 0 (perfect balance), and 10000 (right channel only).
BorderStyle = 0 | 1Specifies the control border's style. BorderStyle=0 indicates no border, while BorderStyle = 1 means a single-line border. Default is 1.
CurrentPosition = nSpecifies a new position into the sound track, in seconds from the beginning of the track.
CurrentStateSpecifies the current state of the sound track: stopped (0), paused (1), or running (2). You cannot set this property, just read its value. You can change its value by calling the Stop(), Pause(), or Play() methods.
DisplayBackColor = colorSpecifies the display panel's background color. First way to specify colors is by normal RGB colors. The valid range for normal RGB colors is between 0 and 16,777,215 (00ffffff). The high byte of this number is zero. The lower three bytes determine, from least to most significant byte, the amount of Red, Green, and Blue, respectively. Each color is represented by a number between 0 and 255 (ff). The second way to specify color is by system color constants listed in the Object Browser's object library. The operating system substitutes the user's choices as specified in the Control Panel settings.
DisplayForeColor = colorSpecifies the display panel's foreground color. First way to specify colors is by normal RGB colors. The valid range for normal RGB colors is between 0 and 16,777,215 (00ffffff). The high byte of this number is zero. The lower three bytes determine, from least to most significant byte, the amount of Red, Green, and Blue, respectively. Each color is represented by a number between 0 and 255 (ff). The second way to specify color is by system color constants listed in the Object Browser's object library. The operating system substitutes the user's choices as specified in the Control Panel settings.
DisplayMode = 0 | 1Specifies whether the display panel shows the track position in seconds (DisplayMode=0) or frames (DisplayMode=1). Default is 0.
EnableContextMenu = true | falseSpecifies whether or not to enable the shortcut menu. You can invoke this menu by right-clicking anywhere on the control. Default is true.
Enabled = -1 | 0Specifies whether the control panel is enabled (Enabled=-1) or not (Enabled = 0). Default is -1.
EnablePositionControls = true | falseSpecifies whether or not to show the position buttons in the control panel. Default is true.
EnableSelectionControls = true | falseSpecifies whether or not to show the selection buttons in the control panel. Default is true.
EnableTracker = true | falseSpecifies whether or not to show the trackbar control in the control panel. Default is true.
FileName = URLSpecifies the file name where the sound track is stored.
PlayCount = nSpecifies the number of times to loop the sound track.
rate = dSpecifies the playing speed with respect to its authored one. rate = 1.0 indicates a normal sound playing. rate = 2.0, for example, indicates a double speed. Audio tracks are difficult to understand when rate < 0.5 and when rate > 1.5
ReadyStateReturns the control's state of readiness. There are four possible return values: 0 if the control is synchronously loading a file, 1 if the FileName property has not been initialized, 3 if the control has loaded enough data to start playing but not all data, and 4 if all data has been downloaded. This property is read-only and cannot be set. The play() method will work only if ReadyState is equal to or greater than 3.
SelectionEnd = nSpecifies the desired end position in seconds from the beginning of the sound track. The property is accessible only after the file is loaded completely. Shown on the digital display panel.
SelectionStart = nSpecifies the desired start position in seconds from the beginning of the sound track. The property is accessible only after the file is loaded completely. Shown on the digital display panel.
ShowControls = true | falseSpecifies whether or not to show the control panel. Default is true
ShowDisplay = true | falseSpecifies whether or not to show the display panel. Default is true
ShowPositionControls = true | falseSpecifies whether or not to show the position controls. Position controls include four buttons: Previous, Rewind, Forward, and Next. If the current media position is after SelectionStart, Previous returns the media position to SelectionStart. If the current media position is before the SelectionStart, Previous returns the media position to the beginning of the sound track. If the current media position is before SelectionStart, Next sets the media position to SelectionStart. If the current media position is after the SelectionStart, Next sets the media position at the end of the sound track. Default is false

The usage of these properties is demonstrated later in this column, in the Audio Control Example.

http://www.internet.com


Created: May 31, 1998
Revised: May 16, 1999

URL: http://www.webreference.com/js/column20/amproperties.html