AudioPlayerManager
The Flex AudioPlayerManager API supports playing, stopping and muting sounds. To learn more go to Flex Sounds
play(mediaData, onError?) => string#
Plays the media provided.
Parameters:
- mediaData: AudioPlayerManager.MediaData- Media data to be played. - url: string- URL of the media.
- repeatable: boolean- Whether the media should repeat or not.
 
- onError?: (error) => void- Callback to be invoked when there is an error playing media. - error: AudioPlayerManager.Error- Audio Player error.
- code: AudioErrorCode- Error code
- void
 
Returns:
- string- Unique identifier of the media. 
Example:
const mediaId = AudioPlayerManager.play(    {        url: "sound-url",        repeatable: true    },    (error: AudioPlayerError) => {        // handle error    });stop(mediaId) => void#
Stop media given the unique identifier of the media.
Parameters:
- mediaId: string- Id of the media to be stopped. 
Returns:
- void
Example:
AudioPlayerManager.stop(mediaId);toggleSound(mute) => void#
Mutes/unmutes sound based on the given parameter.
Parameters:
- mute: boolean- Mutes the audio if true or unmutes if false. 
Returns:
- void
Example:
AudioPlayerManager.toggleSound(true); // mutes soundAudioPlayerManager.toggleSound(false); // unmutes soundexports.AudioErrorCode: 0 | 1 | 2#
ErrorCode
Properties:
- NotAllowed: 0- Playing audio is not allowed by your system 
- InvalidMedia: 1- You provided an invalid media or the url is invalid 
- Other: 2- An unknown has occured 
Rate this page