Class TPlayer
The TPlayer object acts as a proxy class to the TWMPlayer and the TSLPlayer classes. If IE is used as browser an instance of TWMPlayer is
created. If Firefox is used and the Silverlight installation is detected an instance of TSLPlayer is created else an instance of TWMPlayer is created.
All "common" functionality of the TWMPlayer or TSLPlayer are exposed by TPlayer.
Defined in: <class.player.js>.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
TPlayer()
|
| Field Attributes | Field Name and Description |
|---|---|
|
Specifies whether the player will automatically start playing the media URL assigned to it
when the createPlayer function has been successfully called.
|
|
|
The height of the player.
|
|
|
The unique ID of the media player.
|
|
|
The URL of the media that will be played by the media player.
|
|
|
Re-expose the onBuffering event.
|
|
|
Re-expose the onClick event fired when one clicks on the player.
|
|
|
Re-expose the onData event.
|
|
|
Event is fired after player is fully loaded.
|
|
|
Re-expose the onPlayerStatusChange event.
|
|
|
Specifies whether the control bar ( contains the Play, Stop, Previous, Next, Pause, and Mute buttons
as well as the volume control slider) must be displayed on the media player.
|
|
|
The width of the player.
|
| Method Attributes | Method Name and Description |
|---|---|
|
attachPlayer(PlayerObj)
DO NOT USE! Alias to #attachPlayerWrapper.
|
|
|
attachPlayerWrapper(PlayerObj)
Attach external player wrapper (Javascript wrapper class only! Not actual player object) .
|
|
|
createPlayer(owner)
Create player object.
|
|
|
Fade(volume, time, startVolume)
Fades to specified volume level in specified time period.
|
|
|
Cancel any active fades
|
|
|
Returns the media player's buffering progress.
|
|
|
Get's the Player's context type (i.e.
|
|
|
getMute()
Get's the media player's current muted state.
|
|
|
getMuted()
Get's the media player's current muted state.
|
|
|
DO NOT USE.
|
|
|
Returns the media player's normalized current status code (1-5).
|
|
|
Get's the Player WRapper object (i.e.
|
|
|
Returns the media player's normalized current status message.
|
|
|
Get's the media player's volume.
|
|
|
Hide()
Hides the media player.
|
|
|
True if the media player is buffering.
|
|
|
True if the player object is controlable through scripting.
|
|
|
isLoaded()
Player's loading status.
|
|
|
Open(url)
Opens the requested media URL.
|
|
|
Pause()
Pauses the playing of the media player.
|
|
|
Play()
Causes the media player to start playing.
|
|
|
PreBuffer(url)
Opens the requested media URL & pre-buffers the content.
|
|
|
setMute(muted)
Set's the media player's muted state.
|
|
|
setMuted(muted)
Set's the media player's muted state.
|
|
|
setSize(width, height)
Sets the player width and height
|
|
|
setVolume(volume)
Set's the media player's volume.
|
|
|
Show()
Displays the media player.
|
|
|
Stop()
Stops the playing of the media player.
|
|
|
Mute's or un-Mute 's the media player depending on if it is currently muted or not.
|
Field Detail
{bool}
autostart
Specifies whether the player will automatically start playing the media URL assigned to it
when the createPlayer function has been successfully called.
- Default Value:
- true
{int}
height
The height of the player.
- Default Value:
- 240
{string}
id
The unique ID of the media player.
- Default Value:
- null
{string}
mediaurl
The URL of the media that will be played by the media player.
Note: .asx ( client-side playlist) files can be played and can have references to other .asx files aswell.
Avoid using relative paths for ASX files. TWMPlayer works with relative paths, but TSLPlayer does not.
Also note that TSLPlayer does not support all the elements of an ASX file - so make sure to test your ASX with the TSLPlayer.
{YUI_EVENT}
onBuffering
Re-expose the onBuffering event.
Arguments passed back to the event handler function are:
Arguments passed back to the event handler function are:
- bufferProgress - Buffering progress as a % (0..100)
{YUI_EVENT}
onClick
Re-expose the onClick event fired when one clicks on the player.
No arguments are passed back to event handler function.
No arguments are passed back to event handler function.
{YUI_EVENT}
onData
Re-expose the onData event.
Arguments passed back to the event handler function are:
Arguments passed back to the event handler function are:
- metadata - Media metadata array.
- See:
- TMediaData#onData
{YUI_EVENT}
onLoaded
Event is fired after player is fully loaded. (Some players, like SilverLight, first need to load external content).
No arguments are passed back to event handler function.
No arguments are passed back to event handler function.
{YUI_EVENT}
onPlayerStatusChange
Re-expose the onPlayerStatusChange event.
Arguments passed back to the event handler function are:
Arguments passed back to the event handler function are:
- newstatus - Current normalized status code (1-5) of the media player. Can be 1 - Playing, 2 - Paused, 3 - Stopped, 4 - Buffering, 5 - Error
{string}
showcontrols
Specifies whether the control bar ( contains the Play, Stop, Previous, Next, Pause, and Mute buttons
as well as the volume control slider) must be displayed on the media player.
A settings of "auto" will only show the controls if the player is not controlable via web buttons, i.e. WMP in FireFox.
Note: Instead of using the control bar, Html buttons and controls can be used to operate the player.
Valid values are "auto", true or false.
- Default Value:
- "auto"
{int}
width
The width of the player.
- Default Value:
- 320
Method Detail
attachPlayer(PlayerObj)
DO NOT USE! Alias to #attachPlayerWrapper. Only provided for legacy reasons and will be removed in the future.
- Parameters:
- {object} PlayerObj
- External player wrapper.
- See:
- #attachPlayerWrapper
attachPlayerWrapper(PlayerObj)
Attach external player wrapper (Javascript wrapper class only! Not actual player object) .
var slplayer = new TSLPlayer();
slplayer.createPlayer('idPlayer');
var player = new TPlayer();
player.attachPlayer(slplayer);
- Parameters:
- {object} PlayerObj
- External player wrapper.
createPlayer(owner)
Create player object.
The owner of the player is a DOM tag element, usually a DIV tag. If no owner is supplied, the BODY tag is used.
If IE is used as browser an instance of TWMPlayer is created.
If Firefox is used and the Silverlight installation is detected an instance of TSLPlayer is created else an instance of TWMPlayer is created.
Note: Other player types may be added later.
- Parameters:
- {string} owner
- The ID/Name of a DOM tag element, usually body
Fade(volume, time, startVolume)
Fades to specified volume level in specified time period.
- Parameters:
- {int} volume
- Destination volume (0..100)
- {int} time
- Duration of entire fade, in milliseconds
- {int} startVolume
- Starting volume. If null, use current volume
FadeCancel()
Cancel any active fades
getBufferProgress()
Returns the media player's buffering progress.
Returned value is 0 to 100.
getContextName()
Get's the Player's context type (i.e. 'TSLPlayer', 'TFLPlayer', 'TWMPlayer')
getMute()
Get's the media player's current muted state.
getMuted()
Get's the media player's current muted state.
getPlayer()
DO NOT USE. Alias for #getPlayerWrapper. Provided for legacy reasons only.
- See:
- #getPlayerWrapper
getPlayerStatus()
Returns the media player's normalized current status code (1-5).
getPlayerWrapper()
Get's the Player WRapper object (i.e. TSLPlayer, TFLPlayer or TWMPlayer)
getStatusMessage()
Returns the media player's normalized current status message.
The messages for the codes are:
- 1-Playing...
- 2-Paused.
- 3-Stopped.
- 4-Buffering...
- 5-Error.
getVolume()
Get's the media player's volume.
The value of the volume returned ranges from 0 to 100.
Hide()
Hides the media player.
isBuffering()
True if the media player is buffering.
isControllable()
True if the player object is controlable through scripting.
{bool}
isLoaded()
Player's loading status.
- Returns:
- {bool} Returns TRUE if player is done loading (successfully), else false.
Open(url)
Opens the requested media URL. If autostart was true, the playback will start.
- Parameters:
- {string} url
- The media url to be loaded by the media player.
Pause()
Pauses the playing of the media player.
Note: Pausing of a live stream is not supported.
Play()
Causes the media player to start playing.
PreBuffer(url)
Opens the requested media URL & pre-buffers the content.
NOTE: This will automatically set #autostart to false!
- Parameters:
- {string} url
- The media url to be loaded by the media player.
setMute(muted)
Set's the media player's muted state.
- Parameters:
- {bool} muted
- True or False value that indicates whether the media player must be muted or un-muted.
setMuted(muted)
Set's the media player's muted state.
- Parameters:
- {bool} muted
- True or False value that indicates whether the media player must be muted or un-muted.
setSize(width, height)
Sets the player width and height
- Parameters:
- {int} width
- Player width (in pixels)
- {int} height
- Player height (in pixels)
setVolume(volume)
Set's the media player's volume.
- Parameters:
- {int} volume
- The value to which the volume is set. The range is from 0 to 100.
Show()
Displays the media player.
Stop()
Stops the playing of the media player.
toggleMute()
Mute's or un-Mute 's the media player depending on if it is currently muted or not.