Members
    
        
        
0
|
1
|
2
    
    
    
            
            # static readonly exports.ErrorCode
    ErrorCode
    Properties:
| Name | Type | Description | 
|---|---|---|
| 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 | 
Methods
# static play(mediaData, onErroropt) → {string}
        Plays the media provided
    
    
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| mediaData | AudioPlayerManager.MediaData | Media data to be played | |
| onError | AudioPlayerManager.ErrorHandler | <optional> | Callback to be invoked when there is an error playing media | 
Unique identifier of the media
    
    
    
        
        
string
    
    
Example
const mediaId = AudioPlayerManager.play(
    {
        url: "sound-url",
        repeatable: true
    },
    (error: AudioPlayerError) => {
        // handle error
    }
);# static stop(mediaId) → {void}
        Stop media given the unique identifier of the media
    
    
    Parameters:
| Name | Type | Description | 
|---|---|---|
| mediaId | string | Id of the media to be stopped | 
        
        
void
    
    
Example
AudioPlayerManager.stop(mediaId);# static toggleSound(mute) → {void}
        Mutes/unmutes sound based on the given parameter
    
    
    Parameters:
| Name | Type | Description | 
|---|---|---|
| mute | boolean | Mutes the audio if true or unmutes if false | 
        
        
void
    
    
Example
AudioPlayerManager.toggleSound(true); // mutes sound
AudioPlayerManager.toggleSound(false); // unmutes soundType Definitions
    
        
        
Object
    
    
    
            
                # Error
    Audio Player error. This is the error type that you receive when the ErrorHandler function is invoked
    Properties:
| Name | Type | Description | 
|---|---|---|
| code | AudioPlayerManager.ErrorCode | Error code | 
# ErrorHandler(error) → {void}
        Defines the type of the error callback function. Invoked when `play` method returns an error.
    
    
    Parameters:
| Name | Type | Description | 
|---|---|---|
| error | AudioPlayerManager.Error | Audio Player error | 
        
        
void
    
    
    
        
        
Object
    
    
    
            
            # MediaData
    Media data to be played
    Properties:
| Name | Type | Description | 
|---|---|---|
| url | string | URL of the media | 
| repeatable | boolean | Whether the media should repeat or not |