PlayWave Method

PocketBrowser 3.x API

The PlayWave Method of the Generic ActiveX Object plays the specified WAV file.

PlayWave (Method of the Generic ActiveX Object) Syntax
var RetVal = Generic.PlayWave(strSound, iFlags);

ParametersW Toggle Parameters

Items listed in this section indicate parameters, or attributes which can be set.

Name Possible Values Description
Default Value
strSound String the name of the WAV file to play. If the specified file does not exist the default sound will be played unless specified by the flags. N/A
iFlags String Flags for playing the file. The flags can be combined (refer to the remarks section of this page) N/A

axReturns Toggle Return Values

Name Description
bRetVal A boolean value to indicate success or failure of the operation. Note that synchronous sounds will block until they have finished playing.

Examples Toggle Examples

The following plays a wave file called "alarm1.wav":

<script>
function onPlay()
{
var objGeneric = new ActiveXObject("PocketBrowser.Generic");

objGeneric.PlayWave('\\windows\\alarm1.wav', 1);
}
</script>
Copy example to clipboard Copy example to clipboard

Remarks Toggle Remarks

Play Flags
Flags are as follows:
0x00000000 = Play synchronously (default).  The function returns after the sound event completes.
0x00000001 = The sound is played asynchronously.  To terminate an asynchronously played waveform 
sound, call PlayWave with strSound set to null.
0x00000002 = No default sound event is used. If the sound cannot be found, PlayWave returns 
silently without playing the default sound.
0x00000004 = A sound event's file is loaded in RAM. The parameter specified by strSound must point 
to an image of a sound in memory.
0x00000008 = The sound plays repeatedly until PlayWave is called again with the strSound parameter 
set to null. You must also specify the 0x00000001 flag to indicate an asynchronous 
sound event.
0x00000010 = The specified sound event will yield to another sound event that is already playing. 
If a sound cannot be played because the resource needed to generate that sound is 
busy playing another sound, the function immediately returns without playing the 
requested sound.  If this flag is not specified, PlaySound attempts to stop the 
currently playing sound so that the device can be used to play the new sound.

Info Toggle Additional Information

Supported Platforms Windows CE, Windows Mobile
Persistence Executes immediately.
Min. Requirements Device must support WAV file playback.