Class: base

caph.stripe.ui.widget.audioPlayer. base

new base()

This is a Audio player base class which have following contains

  1. All the common functions that are not device specific like a. UI Creation b. Playlist generation c. Event handling d Error Handling

Members

<static> self :Object

Audio instance

Type:
  • Object

<static, constant> this.baseCssClass :String

Type:
  • String

<static> this.controls :Object

Object to contain the audio player controls

Type:
  • Object

<static, constant> this.currentPos :Number

Type:
  • Number

<static> this.curState :String

Audio player current state Play pause playing

Type:
  • String

<static, constant> this.errorPopup :Object

Type:
  • Object

<static, constant> this.hasLoaded :Boolean

Type:
  • Boolean

<static, constant> this.index :Number

Type:
  • Number

<static, constant> this.isAudioControlsReq :Number

Audio player width

Type:
  • Number

<static> this.isErrorPopup :Boolean

To check error poup

Type:
  • Boolean

<static> this.isPopupOpen :Boolean

A flag to check whether information popup is in open state

Type:
  • Boolean

<static> this.listeners :Object

List of event need to br trigger from Audio Player

Type:
  • Object

<static> this.messageTimer :Object

Timer to auto close message popup

Type:
  • Object

<static> this.networkInterfaceType :Object

A flag to set / get network connection

Type:
  • Object

<static> this.owner :Object

Event Firing / listening owner

Type:
  • Object

<static> this.pauseButton :Object

Variable to store pauseButton object

Type:
  • Object

<static> this.playButton :Object

Variable to store playbutton object

Type:
  • Object

<static> this.playList :Object

Audio Player array list of audio file urls contains file name , title , singer etc.

Type:
  • Object

<static> this.preState :String

Audio player previous state Play pause playing

Type:
  • String

<static> this.progressBar :Object

Progress bar object , need to create while iniliaze audio player

Type:
  • Object

<static, constant> this.repeatMode :String

Type:
  • String

<static> this.scrollBar :Object

scroll bar object , need to create while iniliaze audio player

Type:
  • Object

<static, constant> this.shuffleMode :String

Type:
  • String

<static, constant> this.topItemIndex :Number

Type:
  • Number

Methods

<static> addListener(eventName, callback, Context)

Add event listener

Parameters:
Name Type Description
eventName String

name of event for listen for

callback function

function that will fire when event triggered

Context Object

of event

Example
audioObj.addListener('currentplayTime',function(){
console.log(arguments[0]);
},this);

<static> clearItems()

Clear All items of PlayList

Example
audioObj.clearItems();

<static> close()

Close audio player object. Destroy audio player object Destroy method deletes dom elemement from the scene . Some time it cause run time exception while deleting the DOM from scene. Due to exception, code stops responding . We need to catch this exception and proceed further.

Example
audioObj.close();

<static> getCurIndex() → {Number}

Get a current index of PlayList.

Returns:

A current index of PlayList

Type
Number
Example
audioObj.getCurIndex();

<static> getCurItem() → {Object}

Get a current item of PlayList.

Returns:

A current item of PlayList

Type
Object
Example
audioObj.getCurItem();

<static> getCurrentPosition() → {object}

This method get current play time of player

Returns:

a Current Position *Properties :

millisecond - (Number) timeString - (String)
Type
object
Example
audioObj.getCurrentPosition();

<static> getCurrentState() → {string}

This method get current player state.

Returns:

a state of player player State :

playing stopped paused buffering error
Type
string
Example
audioObj.getCurrentState();

<static> getItem(index) → {Object}

Get an item of PlayList.

Parameters:
Name Type Description
index Number

An index of an item to get

Returns:

An item of PlayList

Type
Object
Example
audioObj.getItem(2);

<static> getRepeatMode() → {String}

Get a current repeat mode.

Returns:

A current repeat mode ('norepeat'/'one'/'all')

Type
String
Example
audioObj.getRepeatMode();

<static> getShuffleMode() → {Boolean}

Get whether the shuffle mode is currently on.

Returns:

A current shuffle mode (true/false)

Type
Boolean
Example
audioObj.getShuffleMode();

<static> removeListener(eventName, handler)

This method removes the listener of event.

Parameters:
Name Type Argument Default Description
eventName String

Event name to remove.

handler function <optional>
undefined

Event handler function to remove. If the given handler function is registered more than once, this method removes them all. If this parameter is omitted, this function removes every handlers of the event.

Example
audioObj.removeListener('currentplayTime',function(){
console.log(arguments[0]);
});

<static> setCurIndex(index)

Set a current index of PlayList.

Parameters:
Name Type Description
index Number

An index of an item to set

Example
audioObj.setCurIndex(1);

<static> setRepeatMode(mode)

Set a repeat mode.

Parameters:
Name Type Description
mode String

A repeat mode to set ( 'norepeat'/'one'/'all')

Example
audioObj.setRepeatMode('norepeat');

<static> setShuffleMode(shuffleMode)

Set whether the shuffle mode is currently on.

Parameters:
Name Type Description
shuffleMode Boolean

A shuffle mode to set (true/false)

Example
audioObj.setShuffleMode(true);

<static> trigger(eventName, anything) → {Array}

This method invokes the registered listers of given event with parameter.

Parameters:
Name Type Description
eventName String

Event name to trigger.

anything Varient

From this second parameter will be passed to the registered listener.

Returns:

Array stores return values of handlers.

Type
Array