4D v13.4

PLAY

Home

 
4D v13.4
PLAY

PLAY 


 

PLAY ( objectName {; channel} ) 
Parameter Type   Description
objectName  String in Name of sound file or Mac OS 'snd' resource or system sound
Empty string for stopping asynchronous play
channel  Longint in If specified, synthesizer channel and asynchronous execution; If omitted, synchronous execution

The PLAY command plays sound or multimedia files. You pass the full pathname of the file you want to play in objectName. On Mac OS, the command can also be used to play a sound resource or a system sound.

  • To play a file, pass its name and pathname in objectName. You can pass a full pathname or a pathname relative to the database structure file.
    The main sound and multimedia file formats are supported: .WAV, .MP3, .AVI, .AIFF (Mac OS), etc. Under Mac OS, the command supports more particularly the Core Audio formats.
    Note: You cannot play multimedia files or objects in asynchronous mode. To do so, use OLE Services.
  • (Mac OS only) To play a system sound, pass its name directly in the objectName parameter.
    Note: By compatibility, 4D first looks for an 'snd' resource named objectName.

The channel parameter specifies the Macintosh synthesizer channel. If channel is not specified, the channel is used for simple digitized sounds and is synchronous. Synchronous means that all processing stops until the sound has finished playing. If channel is 0, the channel is for simple digitized sounds and is asynchronous. Asynchronous means that processing does not stop and the sound plays in the background.

To stop playing a synchronous sound, use the following statement:

 PLAY("";0)

The following example shows how to play a video file on Windows:

 $DocRef :=Open document("";"AVI")
 If(OK=1)
    CLOSE DOCUMENT($DocRef)
    PLAY(Document)
 End if

The following example code appears in a startup method. It welcomes the user with a sound called Welcome Sound on Macintosh:

 PLAY("Welcome Sound") ` Play the Welcome Sound

 
PROPERTIES 

Product: 4D
Theme: User Interface
Number: 290

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: < 4D v6
Modified: 4D v11 SQL

 
SEE ALSO 

BEEP