Class media.player
Extends
media.display.
The core media player class which governs the media player
functionality.
Usage:
// Create a media player.
var player = $("#player").mediaplayer({
});
Defined in: drupal.media.player.js.
Constructor Attributes | Constructor Name and Description |
---|---|
media.player(context, options)
|
Field Attributes | Field Name and Description |
---|---|
All of the plugin objects.
|
|
Variable to store the current media player.
|
|
The current player.
|
Method Attributes | Method Name and Description |
---|---|
addPlugin(id, plugin)
Add a new plugin to the media player.
|
|
Get the current media duration.
|
|
getMediaFile(files)
Returns the full media player object.
|
|
getPlugin(id)
Returns a plugin provided a plugin ID.
|
|
Get the current volume setting.
|
|
load(files)
Load a set of files or a single file for the media player.
|
|
pause()
Pause the media.
|
|
play()
Play the currently loaded media file.
|
|
seek(pos)
Seek the media to the provided position.
|
|
setVolume(vol)
Set the volume of the media being played.
|
|
stop()
Stop the media.
|
- Methods borrowed from class media.display:
- getElements, isValid
- Methods borrowed from class media.plugin:
- setPlayer
Class Detail
media.player(context, options)
- Parameters:
- {object} context
- The jQuery context.
- {object} options
- This components options.
Field Detail
allPlugins
All of the plugin objects.
currentPlayer
Variable to store the current media player.
media
The current player.
Method Detail
addPlugin(id, plugin)
Add a new plugin to the media player.
- Parameters:
- {string} id
- The plugin ID.
- {object} plugin
- A new plugin object, derived from media.plugin.
construct()
- See:
- media.plugin.construct
{number}
getDuration()
Get the current media duration.
- Returns:
- {number} The current media duration.
{object}
getMediaFile(files)
Returns the full media player object.
- Parameters:
- {array} files
- An array of files to chose from.
- Returns:
- {object} The best media file to play in the current browser.
{object}
getPlugin(id)
Returns a plugin provided a plugin ID.
- Parameters:
- {string} id
- The plugin ID to retrieve.
- Returns:
- {object} The plugin matching the provided ID.
{number}
getVolume()
Get the current volume setting.
- Returns:
- {number} The current volume level. 0 to 1.
load(files)
Load a set of files or a single file for the media player.
- Parameters:
- {array} files
- An array of files to chose from to load.
pause()
Pause the media.
play()
Play the currently loaded media file. Use load first to load a
media file into the media player.
seek(pos)
Seek the media to the provided position.
- Parameters:
- {number} pos
- The position to seek. 0 to 1.
setVolume(vol)
Set the volume of the media being played.
- Parameters:
- {number} vol
- The volume to set. 0 to 1.
stop()
Stop the media.