Class Details

Class mcPlayer
Version 1.01.

mcPlayer()
mcPlayer ... Multi Channel Player
Author: Axel Hahn.
Version: 1.01.
// --- #1
oMcPlayer=new mcPlayer();
oMcPlayer.init();         // draw player gui
oMcPlayer.minimize(true); // ... and hide the gui without animation

// --- #2
var oMcPlayer = new mcPlayer({
  settings:{
    autoopen: true,
    repeatlist: false
  }
});
oMcPlayer.init();     // draw player gui
oMcPlayer.minimize(); // ... and hide the gui
Returns:
nothing

Public Methods

addAudio

{Boolean} addAudio(aSong)

add a song to the playlist


					
					
					
						
							
Parameters:
{array} aSong
Returns:
{Boolean}

canPlaySurround

{boolean} canPlaySurround()

Check: does the browser support 5.1 channels?
tablets and mobile devices: false
older Opera versions: false
all other: true

Returns:
{boolean}

disableRepeat

{undefined} disableRepeat()

disable playing option repeat playlist

Returns:
{undefined}

disableShuffle

{undefined} disableShuffle()

disable playing option shuffle playlist

Returns:
{undefined}

disableStatusbar

{boolean} disableStatusbar()

disable playing option shuffle playlist

Since:
v0.33
Returns:
{boolean}

enableRepeat

{undefined} enableRepeat()

enable playing option repeat playlist

Returns:
{undefined}

enableShuffle

{undefined} enableShuffle()

enable playing option shuffle playlist

Returns:
{undefined}

enableStatusbar

{boolean} enableStatusbar()

enable playing option shuffle playlist

Since:
v0.33
Returns:
{boolean}

getAllAudioChannels

{float} getAllAudioChannels()

get an array of valid channels of the current song; if no song is active it returns false.

Returns:
{float}

getAudioChannels

{integer} getAudioChannels()

get current count of channels of the current song you typically get "2.0" for stereo or "5.1" for surround

Returns:
{integer}
See:
getAllAudioChannels() to get the available channels of a song

getAudioDuration

{float} getAudioDuration()

get duration in [sec] of the current song

Returns:
{float}

getAudioNetworkstate

{Integer|false} getAudioNetworkstate()

get network state of current audio (i.e. loading / idle) https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/networkState

Returns:
{Integer|false}

getAudioPosition

{float} getAudioPosition()

get position in [sec] of the current song

Returns:
{float}

getAudioReadystate

{Integer|false} getAudioReadystate()

get document state of current audio https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState

Returns:
{Integer|false}

getAudioSrc

{float} getAudioSrc()

get used source url of the current song

Returns:
{float}

getPlaylist

{array} getPlaylist()

get playlist with all songtitles and its sources

Returns:
{array}

getPlaylistCount

{array} getPlaylistCount()

get playlist with all songtitles and its sources

Returns:
{array}

getPlaylistId

{Number} getPlaylistId()

get id of the currently active song in the playlist (if shuffled)

Returns:
{Number}
See:
getSongId() to get the song based on position in document

getPlayorder

{array} getPlayorder()

get playlist with all songtitles and its sources

Returns:
{array}

getSong

{array} getSong()

get current song; you get an array with the song title and all its audio sources and mime types

Returns:
{array}

getSongAlbum

{string} getSongAlbum()

get album of the currently active song

Returns:
{string}

getSongArtist

{string} getSongArtist()

get artist of the currently active song

Returns:
{string}

getSongBpm

{string} getSongBpm()

get publishing year of the currently active song

Returns:
{string}

getSongGenre

{string} getSongGenre()

get publishing year of the currently active song

Returns:
{string}

getSongId

{Number} getSongId()

get id of the currently active song; first song starts with 0; value -1 means player did not start to play yet.

Returns:
{Number}

getSongImage

{string} getSongImage()

get publishing year of the currently active song

Returns:
{string}

getSongTitle

{string} getSongTitle()

get title of the currently active song

Returns:
{string}

getSongUrl

{string} getSongUrl()

get url for the song i.e. where to buy it

Returns:
{string}

getSongYear

{string} getSongYear()

get publishing year of the currently active song

Returns:
{string}

getVolume

{float} getVolume()

get current volume (a value between 0..1)

Returns:
{float}

init

{boolean} init(sContainerId)

initialize player

Parameters:
{string} sContainerId
id of a div where to put the player. if false player will be added to body
Returns:
{boolean}

isMuted

{Boolean} isMuted()

get boolean value - volume is muted?

Returns:
{Boolean}

isPaused

{Boolean} isPaused()

get boolean value - playing audio is paused?

Returns:
{Boolean}

isPlaying

{Boolean} isPlaying()

get boolean value - audio is playing? It returns true if audio is playing and false if paused or stopped.

Returns:
{Boolean}

isRepeatlist

{Boolean} isRepeatlist()

get boolean value - is shuffling mode on?

Returns:
{Boolean}

isShuffled

{Boolean} isShuffled()

get boolean value - is shuffling mode on?

Returns:
{Boolean}

isStopped

{Boolean} isStopped()

get boolean value - playing audio is stopped

Returns:
{Boolean}

isStream

{Boolean} isStream()

get boolean value - is the curemt played audio a stream? remark: it is detected by audio.duration == Infinity (Chrome) or count of durationchange events (used in Firefox)

Since:
0.33
Returns:
{Boolean}

isVisibleBox

{Boolean} isVisibleBox(sBaseId)

return if a dialog box is visible

Parameters:
{string} sBaseId
sBaseId of the div and the button; one of download|playlist|about
Returns:
{Boolean}

isVisibleBoxAbout

{Boolean} isVisibleBoxAbout()

return if about dialog box is visible

Returns:
{Boolean}

isVisibleBoxDownload

{Boolean} isVisibleBoxDownload()

return if download dialog box is visible

Returns:
{Boolean}

isVisibleBoxPlaylist

{Boolean} isVisibleBoxPlaylist()

return if playlist dialog box is visible

Returns:
{Boolean}

isVisiblePlayer

{Boolean} isVisiblePlayer()

return if player window is visible

Since:
v0.30
Returns:
{Boolean}

isVisibleStatusbar

{Boolean} isVisibleStatusbar()

return if player window is visible

Since:
v0.33
Returns:
{Boolean}

makeMainwindowMovable

{undefined} makeMainwindowMovable(bMove)

set if make the main player window is movable. This method is useful if you added drag and drop support (addi.min.js) for the windows but the main player is fixed on the bottom.

Parameters:
{boolean} bMove
flag true/ false
Returns:
{undefined}

maximize

maximize()

show/ maximize the player GUI

<a href="#" onclick="oMcPlayer.maximize(); return false;">show the player</a>
Returns:
nothing

maximizeBox

{boolean} maximizeBox(sBaseId, bFast)

maximize a box; argument is a base id of a button or div

<button onclick="oMcPlayer.maximizeBox('download')">show Downloads</button>
Parameters:
{string} sBaseId
name of the div ("download" | "playlist" | "about")
{boolean} bFast
flag to override speed in css transistion
Returns:
{boolean}

minimize

minimize(bFast)

minimize player GUI and show a maximize icon

<a href="#" onclick="oMcPlayer.minimize(); return false;">hide player</a>
Parameters:
{boolean} bFast
flag to override speed in css transistion
Returns:
nothing

minimizeBox

{boolean} minimizeBox(sBaseId, bFast)

minimize a box; argument is a base id of a button or div

<button onclick="oMcPlayer.minimizeBox('download')">hide Downloads</button>
Parameters:
{string} sBaseId
name of the div ("download" | "playlist" | "about")
{boolean} bFast
flag to override speed in css transistion
Returns:
{boolean}

playeraction

playeraction(sAction)

handle actions of the player

Parameters:
{string} sAction
name of the action ("play" | "pause" | "stop" | "forward" | "backward" | "jumpprev" | "jumpnext")
Returns:
nothing

setAudioPosition

{boolean} setAudioPosition(iTime)

Set a position of the currently playing audio; It returns the set position; if there is no audio it retuns false

<button onclick="oMcPlayer.setAudioPosition(180.33);">oMcPlayer.setAudioPosition(180.33)</button>
Parameters:
{float} iTime
new position in seconds
Returns:
{boolean}

setChannel

{boolean} setChannel(sChannelId)

set channels to switch between stereo/ surround

Parameters:
{string} sChannelId
number of audiochannels; typically one of "2.0" or "5.1"
Returns:
{boolean}
See:
getAllAudioChannels() to get all valid channels for a song

setConfig

{boolean} setConfig(aCfg)

set config; override default vars

Parameters:
{array} aCfg
array with config items
Since:
v0.30
Returns:
{boolean}

setNextSong

{boolean} setNextSong()

play next song in playlist; if the audio is the last element in the playlist the playlist will be shuffled (if shuffling is enabled). It starts the first audio if the playing option "repeat" is enabled.

<button onclick="oMcPlayer.setNextSong();">next song</button>
Returns:
{boolean}

setPreviousSong

{boolean} setPreviousSong()

start playing the previous song in playlist (if the current audio is not the first played element)

<button onclick="oMcPlayer.setPreviousSong();">previous song</button>
Returns:
{boolean}

setSong

{boolean} setSong(sSongId)

set a (new) song to play based on the position in document.

<a href="#" onclick="oMcPlayer.setSong(0); return false;">first song</a>
<a href="#" onclick="oMcPlayer.setSong(1); return false;">second song</a>
Parameters:
{int} sSongId
number of song to play; the first audio tag in the html document has id 0
Returns:
{boolean}
See:
getPlaylist() to get all audios

setVolume

{boolean} setVolume(iNewVol)

set volume; it works only if a song is playing

<button onclick="oMcPlayer.setVolume(0.75)">75%</button>
Parameters:
{float} iNewVol
volume (0..1)
Returns:
{boolean}

toggleBoxAndButton

{boolean} toggleBoxAndButton(sBaseId, sMode, bFast)

toggle visibility of a box (download, playlist, about)

Parameters:
{string} sBaseId
sBaseId of the div and the button; one of download|playlist|about
{string} sMode
optional: force action; one of minimize|maximize; default behaviuor is toggle
{boolean} bFast
flag to override speed in css transistion
Returns:
{boolean}

toggleRepeat

{undefined} toggleRepeat()

toggle playing option repeat playlist

Returns:
{undefined}

toggleShuffle

{undefined} toggleShuffle()

toggle playing option shuffle playlist

Returns:
{undefined}

toggleStatusbar

{boolean} toggleStatusbar()

toggle playing option shuffle playlist

Since:
v0.33
Returns:
{boolean}

updateOnResize

{undefined} updateOnResize()

update window positions if the browser is resized.

Returns:
{undefined}

updateStatus

{Boolean} updateStatus()

get boolean value - is the curemt played audio a stream? remark: it is detected by audio.duration == Infinity (Chrome) or count of durationchange events (used in Firefox)

Since:
0.33
Returns:
{Boolean}

Documentation was generated by JsDoc Toolkit 2.4.0






Copyright © 2012-2024 Axel Hahn
project page: Sourceforge (en)
GitHub (en)
Axels Webseite (de)
results will be here