documentation

Documentation generator: JsDoc Toolkit 2.4.0
Template: Wink 1.0
Generated on:

Class wink.mm.AudioPlayer

Implements an audio player An audio player based on the HTML5 audio tag. It can also read LRC files The audio player can take several parameters. It takes at least an audio file url but it can also take an LRC file and various parameters to change the player look and behaviour. Use the getDomNode method to add the player to the page

Class Summary
Constructor Attributes Constructor Name and Description
 
wink.mm.AudioPlayer(properties)
Compatibility
Compatibility list Supported platforms / browsers
iOS4, iOS5, iOS6, Android 3.0, Android 3.1, Android 4.0, BlackBerry 7, Windows Phone 7.5, Windows Phone 8

Method Summary

Class Detail

wink.mm.AudioPlayer(properties)
var properties =
{
	source:
	{
		type: 'file',
		url: '../files/myFile.mp3',
		lyrics: '../files/myLyrics.lrc'
	},
	displayControls: 1,
	displayDuration: 1,
	displayCursor: 1,
	silentSeeking: 1
};

audioPlayer = new wink.mm.AudioPlayer(properties);

wink.byId('audio').appendChild(audioPlayer.getDomNode());
Parameters:
{object} properties
The properties object
{object} properties.source
The info about the audio file
{string} properties.source.type
Either 'stream' or 'file'
{string} properties.source.url
The url of the audio file to load
{string} properties.source.lyrics Optional
The url of the LRC file corresponding to the audio file
{integer} properties.displayControls Optional, Default: 1
Specify if the play/pause buttons should be displayed
{integer} properties.displayDuration Optional, Default: 1
Display the time left and the duration of the file
{integer} properties.displayCursor Optional, Default: 1
Specify if the cursor (to manually navigate through the audio file) should be displayed
{integer} properties.silentSeeking Optional, Default: 1
The audio is stopped while the cursor is moved
See:
Test page

Field Detail

{integer} displayControls
Whether the buttons of the player are displayed or not
Default Value:
1
{integer} displayCursor
Whether the progress bar cursor is displayed or not
Default Value:
1
{integer} displayDuration
Whether the duration of the audio file is displayed or not
Default Value:
1
{integer} silentSeeking
Stops the audio while moving the cursor
Default Value:
1
{object} source
The current audio source
{string} state
The current state of the player ("play" or "pause")
{integer} uId
Unique identifier

Method Detail

  • changeSource(type, url, lyrics)
    Change the current audio source
    Parameters:
    {string} type
    Either 'file' or 'stream'
    {string} url
    The file to be played (absolute or relative path)
    {string} lyrics Optional
    The LRC lyrics associated to the file (if any)
  • forward(seconds)
    Change the current audio time
    Parameters:
    {number} seconds
    The number of seconds to change (+: forward ; -: rewind)
  • {HTMLElement} getDomNode()
    Return the dom node containing the audio player
    Returns:
    {HTMLElement} The main dom node
  • pause()
    Stop the current audio file play
  • play()
    Start playing the current audio file

Event Detail

/audioplayer/events/pause
The event is fired when pause is called
/audioplayer/events/play
The event is fired when play is called