Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Play an audio file on local storage of device or on remote server.

Properties

File

A string value indicates the fully qualified name of the file to play.

Url

A string value indicates the URL of audio file

Methods

Play

Start recording.

  • Input Arguments: None
  • Output Argument: None.
  • Return Value: Status Code

Stop

Stop recording.

  • Input Arguments: None
  • Output Argument: None.
  • Return Value: None.

Events

Started

Triggered when playback is started.

  • Parameters:

Name

Type

Description

Status

Enum

See Status Code

...

 Completed

...

Triggered when the playback of entire audio file has completed.

  • Parameters:

Name

Type

Description

Status

Enum

See Status Code

Message

String

...


Stopped

Triggered when playback has been stopped

  • Parameters:

Name

Type

Description

Status

Enum

See Status Code

...

 Code Examples

    Define_Com Class(#xDeviceAudioPlayback) Name(#AudioPlayback)

Evtroutine Handling(#COM_OWNER.Initialize)

...

  
#Play.Enabled :=

...

 false  
#Stop.Enabled := false
Endroutine

Evtroutine Handling(#AudioPlayback.Initialize)

...

  
#Play.Enabled :=

...

 true
#Stop.Enabled := true
Endroutine

Evtroutine Handling(#Play.Click)

...

  
#AudioPlayback.File := 'MyVoice'

...

  
#AudioPlayback.Play()
Endroutine

Evtroutine Handling(#Stop.Click)

...

  
#AudioPlayback.Stop
Endroutine

Evtroutine Handling(#AudioPlayback.Started) Status(#lstatus)

...

  
If (#lstatus = 'OK')

...

    
#Status := 'Playback started'

...

  
Else   
#Status := 'Error starting playback: ' + #lstatus
Endif
Endroutine

Evtroutine Handling(#AudioPlayback.Stopped) Status(#lstatus)

...

  
If (#lstatus = OK)

...

    
#Status := 'Playback stopped'

...

  
Else   
#Status := 'Error stopping playback: ' + #lstatus
Endif
Endroutine

Evtroutine Handling(#AudioPlayback.Completed) Status(#lstatus)

...

  
If (#lstatus = OK)

...

    
#Status := 'Playback completed'

...

  
Else   
#Status := 'Playback completed with error: ' + #lstatus
Endif
Endroutine