Class TSLPlayer
The TSLPlayer object exposes the different properties, functions, methods and callbacks of an instance of a Silverlight Media Player.
Defined in: <class.slplayer.js>.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
|
Specifies whether the Silverlight player will automatically start playing the media URL assigned to it
when the createPlayer function has been successfully called.
|
|
|
Specifies whether a stream will only be sending captioning data or not.
|
|
|
The height of the Silverlight player.
|
|
|
The unique ID of the media player.
|
|
|
The internalID is used to find the MediaElement object in the silverlightAssembly
You should not need to change this value.
|
|
|
The URL of the media that will be played by the Silverlight media player.
|
|
|
Re-expose the onBuffering event.
|
|
|
Re-expose the onClick event.
|
|
|
Re-expose the onData event.
|
|
|
Event is fired after player is fully loaded.
|
|
|
Re-expose the onPlayerStatusChange event.
|
|
|
Subscribe to the onSL_BufferingProgressChanged event to handle any changes in the buffering status.
|
|
|
Subscribe to the onPlayerStatusChange event to handle any changes in the Silverlight media player status.
|
|
|
Subscribe to the onSL_MarkerReached event to handle any raw scripting data that arrives.
|
|
|
Subscribe to the onSL_MediaOpened event to handle any SLP playlist item changes.
|
|
|
Subscribe to the onSL_MouseLeftButtonDown event to handle any instance of the user left-clicking on the Silverlight Control.
|
|
|
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 Silverlight media player.
|
|
|
The URL to the .xap file (all the Silverlight .NET assemblies and the manifest file wrapped into one file
and compressed using the standard .zip compression algorithm) for the Silverlight control.
|
|
|
The width of the Silverlight player.
|
| Method Attributes | Method Name and Description |
|---|---|
|
Test to see if internal player control is still valid.
|
|
|
attachPlayer(PlayerObj)
Register an existing player object.
|
|
|
createPlayer(owner)
Create player that is ready for use within HTMLView pages.
|
|
|
Returns the media player's buffering progress.
|
|
|
Object's context name - "TSLPlayer"
|
|
|
getMute()
Get's the media player's IsMuted state.
|
|
|
getMuted()
Get's the media player's IsMuted state.
|
|
|
Get's the slPlayer object
|
|
|
Returns the media player's normalized current status code.
|
|
|
Returns the media player's current state.
|
|
|
Returns the media player's non-normalized current state.
|
|
|
Get's the media player's volume.
|
|
|
Hide()
Hides the Silverlight control.
|
|
|
Checks to see if the media player is buffering or not.
|
|
|
Test to see if the player object is controlable throught scripting.
|
|
| <static> |
TSLPlayer.isInstalled()
Static function to detect if SilverLight plugin is installed.
|
|
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 IsMuted state.
|
|
|
setMuted(muted)
Set's the media player's IsMuted state.
|
|
|
setSize(width, height)
Sets the player width and height
|
|
|
setVolume(volume)
Set's the media player's volume.
|
|
|
Show()
Displays the Silverlight control.
|
|
|
Stop()
Stops the playing of the media player.
|
|
|
Mute's or un-Mute 's the media player depending on the player's current IsMuted state.
|
Field Detail
{bool}
autostart
Specifies whether the Silverlight player will automatically start playing the media URL assigned to it
when the createPlayer function has been successfully called.
- Default Value:
- true
{bool}
caption_only
Specifies whether a stream will only be sending captioning data or not.
- Default Value:
- false
{int}
height
The height of the Silverlight player.
- Default Value:
- 240
{string}
id
The unique ID of the media player.
If not specified, an unique ID will be generated for each new instance of a TSLPlayer object.
{string}
internalID
The internalID is used to find the MediaElement object in the silverlightAssembly
You should not need to change this value.
Note: Must be the same as the MediaElement name in the .xap file or it will not be found.
- Default Value:
- SilverLightPlayer
{string}
mediaurl
The URL of the media that will be played by the Silverlight media player.
It can use the following protocols:
- http://
- mms://
- file://
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 as TSLPlayer may not detect it correctly.
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.
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. (SilverLight players need to load a remote XAP file).
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 Silverlight media player. Can be 1 - Playing, 2 - Paused, 3 - Stopped, 4 - Buffering, 5 - Error
{YUI_EVENT}
onSL_BufferingProgressChanged
Subscribe to the onSL_BufferingProgressChanged event to handle any changes in the buffering status.
Arguments passed back to the event handler function are:
Arguments passed back to the event handler function are:
- Sender
{YUI_EVENT}
onSL_CurrentStateChanged
Subscribe to the onPlayerStatusChange event to handle any changes in the Silverlight media player status.
Arguments passed back to the event handler function are:
Arguments passed back to the event handler function are:
- newstate - Silverlight state code
{YUI_EVENT}
onSL_MarkerReached
Subscribe to the onSL_MarkerReached event to handle any raw scripting data that arrives.
Arguments passed back to the event handler function are:
Arguments passed back to the event handler function are:
- MediaElement - the name of the script
- bstrParam - the data of the script
{YUI_EVENT}
onSL_MediaOpened
Subscribe to the onSL_MediaOpened event to handle any SLP playlist item changes.
Arguments passed back to the event handler function are:
Arguments passed back to the event handler function are:
- Item - Playlist media item.
- See:
- TMediaData#onMedia
{YUI_EVENT}
onSL_MouseLeftButtonDown
Subscribe to the onSL_MouseLeftButtonDown event to handle any instance of the user left-clicking on the Silverlight Control.
No arguments are passed back to event handler function.
No arguments are passed back to event handler function.
{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 Silverlight media player.
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"
{string}
silverlightAssembly
The URL to the .xap file (all the Silverlight .NET assemblies and the manifest file wrapped into one file
and compressed using the standard .zip compression algorithm) for the Silverlight control.
You should not need to change this value.
{int}
width
The width of the Silverlight player.
- Default Value:
- 320
Method Detail
assertPlayer()
Test to see if internal player control is still valid.
If it's not set the control to null
attachPlayer(PlayerObj)
Register an existing player object.
Find the existing player object by ID/Name.
Subscribes local event handlers to the player object.
Build functions to fix context of events from player object.
Attach events to player object.
- Parameters:
- {string} PlayerObj
- The ID/Name of the existing player object
createPlayer(owner)
Create player that is ready for use within HTMLView pages.
The owner of the player is a DOM tag element, usually the body. If no owner is supplied, the body is used.
Using the Silverlight.createObjectEx function the Silverlight Control hosting the SL player is created.
On the onLoad event of the Silverlight Control, the SL player is then initialized.
- Parameters:
- {string} owner
- The ID/Name of a DOM tag element, usually body
getBufferProgress()
Returns the media player's buffering progress. Can be a value from 0 to 100.
{string}
getContextName()
Object's context name - "TSLPlayer"
- Returns:
- {string} Returns the name of the player "class", i.e. "TSLPlayer"
getMute()
Get's the media player's IsMuted state.
getMuted()
Get's the media player's IsMuted state.
getPlayer()
Get's the slPlayer object
getPlayerStatus()
Returns the media player's normalized current status code.
The codes are:
- 1-Playing
- 2-Paused
- 3-Stopped
- 4-Buffering
- 5-Error
getSLPlayState()
Returns the media player's current state.
getSLPlayStateMessage()
Returns the media player's non-normalized current state. E.g. The state exposed by the Silverlight SDK's mediaelement object.
getVolume()
Get's the media player's volume.
The value of the volume returned ranges from 0 to 100.
Hide()
Hides the Silverlight control.
isBuffering()
Checks to see if the media player is buffering or not.
isControllable()
Test to see if the player object is controlable throught scripting.
NB! Will always be true for the Silverlight media player, might not be for the embedded WM player.
<static>
{bool}
TSLPlayer.isInstalled()
Static function to detect if SilverLight plugin is installed.
- Returns:
- {bool} Returns TRUE if Silverlight plugin is detected. (Of required version, currently '2.0')
{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.
- Parameters:
- {string} url
- The media url to be loaded by the media player.
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.
NOTE: This will automatically set #autostart to false!
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 IsMuted 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 IsMuted 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 Silverlight control.
Stop()
Stops the playing of the media player.
toggleMute()
Mute's or un-Mute 's the media player depending on the player's current IsMuted state.