spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column20


Audio Control Example

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

Let's look at an example that demonstrates many of the LiveAudio and ActiveMovie methods. The following form lets you set several properties of the LiveAudio plug-in and ActiveMovie Control:

Sound card enabled:
State:
Position:
Filename:





The code is shown on the next page. The script is fairly straightforward. Let's take one function to demonstrate the principles of object referencing:

function playIt() {
  if (!audioEnabled) return;
  if (IEsound) document.audiopanel.play()
  else if (NSsound) document.audiopanel.play(true);
  state();
  timerID = setTimeout("showPosition()", 1000);
}

Explorer plays a sound track by the play() method, while Navigator does it with the play() one. Differences stem from the fact that Navigator uses the LiveAudio plug-in, while Explorer uses the ActiveMovie Control, as explained earlier in this column. On both browsers, an object is referenced as document.audiopanel, where audiopanel is the value of the <EMBED> tag's NAME attribute. The function state() prints the state of the sound control, and the last line of the playIt() function invokes the setInterval() function to update the position of the track every 1000 ms.

Notice that the Explorer' ActiveMovie Control supports several features that Navigator does not. For example, Explorer lets you read the current playing position along the track, the audio file name, and if the sound card is enabled. Compare the feature table of LiveAudio with that of ActiveMovie Control, and you will find many more such features.

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


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

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