14.6.5 xDeviceAudioPlayback Widget

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.

Stop

Stop recording.

Events

Started

Triggered when playback is started.

Name

Type

Description

Status

Enum

See Status Code

 

Completed

Triggered when the playback of entire audio file has completed.

Name

Type

Description

Status

Enum

See Status Code

Message

String

 

 

Stopped

Triggered when playback has been stopped

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