API Docs for:
Show:

AudioProvider Class

Base class for audio providers

Item Index

Methods

Properties

Methods

add

(
  • audioTrack
)

Adds an existing IAudioTrack instance to the array of managed tracks.

Parameters:

  • audioTrack IAudioTrack

    An instance of IAudioTrack

create

(
  • track
)

Creates an IAudioTrack instance from a JSON object. Not implemented in base class.

Parameters:

  • track ITrackConstraint

    A JSON object containing at least a src property

Returns:

null

factory

() IAudioProvider static

Creates an audio provider based on the environment. If running from within a browser, then defaults to HTML5 Audio. If running on a device, it will check for Cordova and Media plugins and use a native audio player, otherwise falls back to HTML5 audio.

Returns:

IAudioProvider:

An IAudioProvider instance

pause

(
  • [index]
)

Pauses a given track.

Parameters:

  • [index] Number optional

    The track id, or if undefined it will pause whichever track currently playing

play

(
  • index
)

Plays a given track.

Parameters:

  • index Number

    The track id

stop

(
  • [index]
)

Stops a given track.

Parameters:

  • [index] Number optional

    The track id, or if undefined it will stop whichever track currently playing

Properties

current

Number

Gets current track id

current

Unknown

Sets current track id

tracks

IAudioTrack

Gets an array of tracks managed by this provider