Play Audio




Introduction


There are 5 actions to play audio.


ACTIONS

  • Play Audio
  • Pause Audio
  • Stop Audio
  • Fast Forward Audio
  • Rewind Audio

These action will work wether the Audio assets are

  • Streamed Audio
    • From a Cloud Collection or any other CMS
    • From an Internet Live Stream
  • Locally stored in the App (on the Device File System)


EVENTS

In addition, Events are set to inform the app on the Play Audio status:

  • Playback Started
  • Playback Paused / Resumed / Completed
  • Playback Error

These Event are accessible at the App Level. 

Any Action can be associated to any of these Event.



AUDIO TUTORIAL

We created an Audio Tutorial app which illustrates how to Play Audio.

Click here to automatically install Audio Tutorial app in your workspace.



PLAY AUDIO

 

 
This illustration of Play Audio configuration comes from the Audio Tutorial App.

Source: The source can be a Live streaming audio link, a file uploaded in an EachScape Cloud Collection, a file in the Media Folder or stored on the device file system.

Album, Sing, Artwork: These are meta data displayed on the device lock screen. They can also be used to illustrate which part is playing.

 


EVENT

App Wide Event are triggered by a Playback.

You can access these event from 2 places.


2. From Event in the App Menu




2. From Configure
From the Event section of the Configure app.
First select Configure from the App Menu

 


Select Events to access App Wide Events then the Audio Playback section:

 


Here are the different App Wide Actions available to trigger action based on these respective events:

 
 

Summary

Using the Audio Actions combined with Events you have full control to develop sophisticated Audio Apps.

Examples of implementation are available in the Audio Tutorial App


You can also check the 'RADIO' base app which showcase how to play live streams from the Internet.




Advanced Features


audioCurrentTime

app/audioCurrentTime gets or sets the playback position for the Audio Block.

The value is returned as hh:mm:ss or mm:ss (if under an hour).


To set the playback position, a similar format must be used to set the position of the playback. For convenience, use the :timeAdd or :timeSub formatters to adjust the current time. See the description of this, below. If you attempt to set the time to a value less than zero, the playback position will be set to the beginning. If you set it beyond the end of the audio track, the playback position will be set to the end of the track. This feature only works if the Audio Block has the "Global Time Sync" option checked. This is an Android-only property.


Learn More

- Slider to control Volume

- Play Video