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.
-
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:
|
Completed
Triggered when the playback of entire audio file has completed.
-
Parameters:
|
Stopped
Triggered when playback has been stopped
-
Parameters:
|
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