Method Summary
|
activateComponent
(
|
This function selects a media component to be used. The player state is not affected. For example, choosing a different audio language. |
| close ( ) | Closes the current session by stopping playback and disconnecting from the media source. |
|
deactivateComponent
(
|
This function deactivates a media component type. |
|
open
(
|
Starts a new stream session by connecting to the media source. Player will transition to ToiMediaPlayerBase.STATE_PAUSED when connected. |
|
play
(
|
Controls playback of the stream. Pace argument decides if it plays, pauses, or enters trickplay. |
|
playFromPosition
(
|
Moves playback position within the current stream and resumes playback. |
|
quickPlay
(
|
A combination of ToiMediaPlayer#close, ToiMediaPlayer#open and ToiMediaPlayer#play. |
|
quickPlayFromPosition
(
|
A combination of ToiMediaPlayer#close, ToiMediaPlayer#open and ToiMediaPlayer#playFromPosition. |
|
setAudioChannelMode
(
|
This function sets the audio channel mode for a given stream identifier. For the active stream the mode will be set instantly. |
|
setParameters
(
|
Sets the values of multipe media player parameters at once. |
|
unsetParameters
(
|
Removes several media player parameters at once. |
Inherited Methods
|
addEventListener
(
|
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners. |
|
getAudioStreamInfo
(
|
Returns information about a specified audio stream in the current media stream multiplex in the form of an audio stream info structure. |
| getCapabilities ( ) → capabilityMask |
Returns the capabilities present for the current session. |
| getError ( ) → error |
Returns the last error. This is typically called when state is changed to ToiMediaPlayerBase.STATE_FAILED. The result is undefined if no error has occurred. |
| getMediaBufferInfo ( ) → info |
Returns information about the current status of the media buffer. |
|
getParameters
(
|
Get the values of several parameters. |
| getPositionInfo ( ) → positionInfo |
Returns pace and position information for the current media session. |
| getPresentationInfo ( ) → info |
Returns the presentation information about current video and audio lock status. Audio locked means audio decoder is started, sample rate is locked and no sync loss. Video locked means video decoder is started and no sync loss. |
| getSessionId ( ) → id |
Returns the session identifier. This identifier can be used to open a session object with ToiMediaService#openSession. |
| getState ( ) → state |
Returns the current state of the media player instance. |
| getStreamInfo ( ) → streamInfo |
Returns information about the current stream in form of a stream info structure. The lists of audio and video streams provided as parts of this information can be used for further exploration using the ToiMediaPlayerBase#getAudioStreamInfo and ToiMediaPlayerBase#getVideoStreamInfo functions, respectively. |
|
getSubtitleStreamInfo
(
|
Returns information about a specified subtitle stream in the current media stream multiplex in the form of a subtitle stream info structure. |
|
getTeletextStreamInfo
(
|
Returns information about a specified teletext stream in the current media stream multiplex in the form of a teletext stream info structure. |
| getUrl ( ) → url |
Returns the URL for the media stream. |
|
getVideoStreamInfo
(
|
Returns information about a specified video stream in the current media stream multiplex in the form of a video stream info structure. |
| releaseInstance ( ) |
This function releases the resources used by this instance. When this function returns all observers has also been released. |
|
removeEventListener
(
|
This method removes an event listener for a specific event. |
|
subscribeParameters
(
|
This function makes the application subscribe to updates of the given list of parameters. The first time an application subscribes to a specific parameter there will be an immediate ToiMediaPlayerParameterChangedEvent notification if the parameter already has a value. |
|
unsubscribeParameters
(
|
This function undoes the effect of a previous call to ToiMediaPlayerBase#subscribeParameters. Any parameters that has not been subscribed to will simply be ignored. |
Methods
This function selects a media component to be used. The player state is not affected. For example, choosing a different audio language.
Parameters:
-
Name Type Description mediaComponentToiMediaPlayerBase.ToiComponentEntry The media component entry to be activated.
Throws:
-
ToiSessionViolationException If the player is in STATE_IDLE a session violation exception is raised.
ToiInvalidArgumentException If the component argument does not identify a valid component, an invalid argument exception is raised.
ToiUnavailableException ToiUnavailableException is raised if the player is temporarily unavailable due to platform resource management.
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners.
Inherited From:
Parameters:
-
Name Type Description typenumber The event type of the event to subscribe to.
listenerToiEventListener The JavaScript function that will receive events.
Throws:
-
ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the application calls addEventListener with the same combination of type and listener twice.
This function ends the current session by stopping any playback and disconnecting from the media source. For example, if the source is a video server it ends the server session and disconnects, or if the source is a multicast channel it leaves that multicast group. If there is an ongoing timeshift on the session it will be stopped or discarded depending on the current timeshift recording configuration ToiInformationService.CFG_MEDIA_TIMESHIFT_RECORDINGPOLICY. If this function returns successfully, the player state will change to STATE_IDLE. If an exception is raised, the player state is unaffected.
Throws:
-
ToiSessionViolationException If the player is in idle state a session violation exception is raised.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
This function deactivates a media component type.
Parameters:
-
Name Type Description mediaTypeToiMediaPlayerBase.ToiComponentType The media component type to be deactivated.
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiInvalidArgumentException Raised if the component argument does not identify a valid component.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
Returns information about a specified audio stream in the current media stream multiplex in the form of an audio stream info structure.
Inherited From:
Parameters:
-
Name Type Description mediaComponentToiMediaPlayerBase.ToiComponentEntry The media component entry for which the stream info has to be retrieved.
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiInvalidArgumentException If the mediaComponent given as argument does not identify an audio stream in the current stream multiplex, an invalid argument exception is raised.
ToiUnavailableException ToiUnavailableException is raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: ToiMediaPlayerBase.ToiAudioStreamInfo
Information about the specified audio stream.
Returns the capabilities present for the current session.
Inherited From:
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiUnavailableException ToiUnavailableException is raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: number
A bit mask describing the capabilities of the current session. The mask can include the following capabilities:
- Bit 0: ToiMediaPlayerBase.CAPABILITY_PAUSE
- Bit 1: ToiMediaPlayerBase.CAPABILITY_REWIND
- Bit 2: ToiMediaPlayerBase.CAPABILITY_FASTFORWARD
- Bit 3: ToiMediaPlayerBase.CAPABILITY_GETPOSITION
- Bit 4: ToiMediaPlayerBase.CAPABILITY_SETPOSITION
- Bit 5: ToiMediaPlayerBase.CAPABILITY_FREEZE
- Bit 6: ToiMediaPlayerBase.CAPABILITY_TIMESHIFT
- Bit 7: ToiMediaPlayerBase.CAPABILITY_MEDIA_BUFFER
Returns the last error. This is typically called when state is changed to ToiMediaPlayerBase.STATE_FAILED. The result is undefined if no error has occurred.
Inherited From:
Returns:
-
Type: ToiMediaPlayerBase.ToiError
The error
Returns information about the current status of the media buffer.
Inherited From:
See also:
Throws:
-
ToiSessionViolationException Raised if the player is in ToiMediaPlayerBase.STATE_IDLE.
ToiOperationNotSupportedException Raised if the session lacks the capability ToiMediaPlayerBase.CAPABILITY_MEDIA_BUFFER to get media buffer info.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: ToiMediaPlayerBase.ToiMediaBufferInfo
The current media buffer information.
Get the values of several parameters.
Inherited From:
See also:
Parameters:
-
Name Type Description namesArray.<ToiMediaSession.ToiParameterName> A list of parameter names.
Throws:
-
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: Array.<ToiMediaSession.ToiParameterInfo>
A list of the returned parameters. If a parameter does not exist (is not set), the status of the corresponding parameter is set to ToiMediaSession.STATUS_NO_PARAMETER.
Returns pace and position information for the current media session.
Inherited From:
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiOperationNotSupportedException If the session lacks the capability to get position, the operation not supported exception is raised.
ToiUnavailableException ToiUnavailableException is raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: ToiMediaPlayerBase.ToiPositionInfo
Position and pace information for the current media session.
Returns the presentation information about current video and audio lock status. Audio locked means audio decoder is started, sample rate is locked and no sync loss. Video locked means video decoder is started and no sync loss.
Inherited From:
Technical Preview:
- This method is a TECHNICAL PREVIEW, it may change.
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiUnavailableException ToiUnavailableException is raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: ToiMediaPlayerBase.ToiPresentationInfo
Information about the current lock status of video and audio.
Returns the session identifier. This identifier can be used to open a session object with ToiMediaService#openSession.
Inherited From:
See also:
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
Returns:
-
Type: ToiMediaSession.ToiSessionId
The session identifier.
Returns the current state of the media player instance.
Inherited From:
Returns:
-
Type: ToiMediaPlayerBase.ToiState
The current player state.
Returns information about the current stream in form of a stream info structure. The lists of audio and video streams provided as parts of this information can be used for further exploration using the ToiMediaPlayerBase#getAudioStreamInfo and ToiMediaPlayerBase#getVideoStreamInfo functions, respectively.
Inherited From:
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiUnavailableException ToiUnavailableException is raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: ToiMediaPlayerBase.ToiStreamInfo
Information about the current stream.
Returns information about a specified subtitle stream in the current media stream multiplex in the form of a subtitle stream info structure.
Inherited From:
Parameters:
-
Name Type Description mediaComponentToiMediaPlayerBase.ToiComponentEntry The media component entry for which the stream info has to be retrieved.
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiInvalidArgumentException If the streamId given as argument does not identify a subtitle stream in the current stream multiplex, an invalid argument exception is raised.
ToiUnavailableException ToiUnavailableException is raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: ToiMediaPlayerBase.ToiSubtitleStreamInfo
Information about the specified subtitle stream.
Returns information about a specified teletext stream in the current media stream multiplex in the form of a teletext stream info structure.
Inherited From:
Parameters:
-
Name Type Description mediaComponentToiMediaPlayerBase.ToiComponentEntry The media component entry for which the stream info has to be retrieved.
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiInvalidArgumentException If the mediaComponent given as argument does not identify a teletext stream in the current stream multiplex, an invalid argument exception is raised.
ToiUnavailableException ToiUnavailableException is raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: ToiMediaPlayerBase.ToiTeletextStreamInfo
Information about the specified teletext stream.
Returns the URL for the media stream.
Inherited From:
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
Returns:
-
Type: string
The URL for the media stream.
Returns information about a specified video stream in the current media stream multiplex in the form of a video stream info structure.
Inherited From:
Parameters:
-
Name Type Description mediaComponentToiMediaPlayerBase.ToiComponentEntry The media component entry for which the stream info has to be retrieved.
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiInvalidArgumentException If the mediaComponent given as argument does not identify a video stream in the current stream multiplex, an invalid argument exception is raised.
ToiUnavailableException ToiUnavailableException is raised if the player is temporarily unavailable due to platform resource management.
Returns:
-
Type: ToiMediaPlayerBase.ToiVideoStreamInfo
Information about the specified video stream.
This function starts a new stream session by trying to establish a connection to a media source. If this function returns successfully, the player state will change to STATE_CONNECTING. If an exception is raised, the player state is unaffected.
Depending on the success of the connection attempt to the media source, the player will make a second state transition to either ToiMediaPlayerBase.STATE_PAUSED or ToiMediaPlayerBase.STATE_FAILED, on success and failure, respectively. In any respect, the application will be notified with the event ToiMediaPlayerStateChangedEvent.
Parameters:
-
Name Type Description urlstring The URL identifying the media source. The URL string may contain additional parameter information in accordance to the extended URL format.
Throws:
-
ToiSessionViolationException If the player is not in idle state at the time of the call to ToiMediaPlayer#open, a session violation exception is raised. OR When query parameter "SessionMode=AttachOnly" is specified in the URL, if no matching session is found with the specified URL in running state (ToiMediaSession.ToiState.STATE_RUNNING), a session violation exception is raised.
ToiInvalidArgumentException If the URL given as argument does not follow the extended URL format, an invalid argument exception is raised.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
This function controls playback of the stream. If this function returns successfully, the player state will change to one of four states: ToiMediaPlayerBase.STATE_PLAYING, ToiMediaPlayerBase.STATE_PAUSED, ToiMediaPlayerBase.STATE_FASTFORWARDING, and ToiMediaPlayerBase.STATE_REWINDING. Different values pace result one of these different states with the corresponding effect. In the case of pausing, it keeps the session alive, i.e. it remains connected to video servers and joined in multicast groups. If an exception is raised, the player state is unaffected.
Parameters:
-
Name Type Description pacenumber The pace at which the position will change, given as a multiplier of normal playback times 1000. Zero will pause the stream. 1000 is normal speed (playing). Values above 1000 will result in fast forward, and below -1000 will result in rewind. This are desired paces, the actual implementation may not set the desired speed, but the different states will change according to this description.
Throws:
-
ToiSessionViolationException Raised if the player does not have an active session and will not have one soon (due to a recent call to Open) either.
ToiOperationNotSupportedException If the player is in a state is which this operation is not supported, an operation not supported exception is raised. This is the case when in ToiMediaPlayerBase.STATE_FAILED, for example. What is supported in which state may in other cases vary depending on which media source is used.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
This function moves the playback position of the current stream and resumes playback at the new position with the desired pace. Streams without a well defined notion of beginning and end, like multicast channels, generally do not support this operation, unless timeshift has been enabled. A position value greater than the length of the stream will be clamped.
If this function returns successfully, the player state will change to one of four states: STATE_PLAYING, STATE_PAUSED, STATE_FASTFORWARDING, and STATE_REWINDING. Different values of pace results in the different states. In the case of pausing, it keeps the session alive, i.e. it remains connected to the video server or the joined in multicast group. If an exception is raised, the player state is unaffected.
Parameters:
-
Name Type Description positionnumber The position, specified as the number of milliseconds from the beginning of the stream, to which the playback position is to be moved. The seekable range of the stream can be obtained by calling the ToiMediaPlayer#getPositionInfo function.
When playing from the timeshift buffer, the constant ToiMediaPlayerBase.POSITION_LIVE can be used to stop buffer playback and start playback of the live stream.
pacenumber The pace at which the position will change, given as a multiplier of normal playback times 1000. Zero will pause the stream. 1000 is normal speed (playing). Values above 1000 will result in fast forward, and below -1000 will result in rewind. This are desired paces, the actual implementation may not set the desired speed, but the different states will change according to this description.
Throws:
-
ToiSessionViolationException Raised if the player does not have an active session and will not have one soon (due to a recent call to Open) either .
ToiOperationNotSupportedException If the player is in a state is which this operation is not supported, an operation not supported exception is raised. This is the case when in ToiMediaPlayerBase.STATE_FAILED, for example. What is supported in which state may in other cases vary depending on which media source is used. The client may investigate this in advance by checking capabilities with ToiMediaPlayer#getCapabilities.
ToiInvalidArgumentException Raised if the position is negative.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
This function closes any existing playback session and starts playback in a new session. It is the combination of ToiMediaPlayer#close, ToiMediaPlayer#open and ToiMediaPlayer#play. If there is an ongoing timeshift on the current session, it will be stopped or discarded depending on the current timeshift recording configuration ToiInformationService.CFG_MEDIA_TIMESHIFT_RECORDINGPOLICY. If this function returns successfully, the player state will change to ToiMediaPlayerBase.STATE_CONNECTING. If an exception is raised, the player state is unaffected.
The player will make a second state transition depending on the result of connecting to new media source. If the player successfully connects to the source and starts playback, the player state will change to ToiMediaPlayerBase.STATE_PLAYING. If not, the state will change to ToiMediaPlayerBase.STATE_FAILED. In any respect, the application will be notified of the state transitio with event ToiMediaPlayerStateChangedEvent. In ToiMediaPlayerBase.STATE_FAILED, ToiMediaPlayer#close or ToiMediaPlayer#quickPlay can be called to reset the player or start new playback, respectively.
See also:
Parameters:
-
Name Type Description urlstring The URL identifying the media source. The URL string may contain additional parameter information in accordance to the extended URL format.
Throws:
-
ToiSessionViolationException Raised if no matching session is found with the specified URL in running state (ToiMediaSession.ToiState.STATE_RUNNING) when query parameter "SessionMode=AttachOnly" is specified in the URL.
ToiInvalidArgumentException Raised if the URL given as argument does not follow the extended URL format.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
This function is same as ToiMediaPlayer#quickPlay, except that it starts playback in a new session from a specified position. Streams without a well defined notion of beginning and end, like multicast channels, generally do not support this operation, and result in state ToiMediaPlayerBase.STATE_FAILED.
See also:
Parameters:
-
Name Type Description urlstring The URL identifying the media source. The URL string may contain additional parameter information in accordance to the extended URL format.
positionnumber The position, specified as the number of milliseconds from the beginning of the stream.
Throws:
-
ToiSessionViolationException Raised if no matching session is found with the specified URL in running state (ToiMediaSession.ToiState.STATE_RUNNING) when query parameter "SessionMode=AttachOnly" is specified in the URL.
ToiInvalidArgumentException Raised if the URL given as argument does not follow the extended URL format, or the position is negative.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
This function releases the resources used by this instance. When this function returns all observers has also been released.
Inherited From:
This method removes an event listener for a specific event.
Inherited From:
Parameters:
-
Name Type Description typenumber The event type of the event to remove the listener from.
listenerToiEventListener The JavaScript function that was previously added as an event listener.
Throws:
-
ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the listener has not previously been added.
This function sets the audio channel mode for a given stream identifier. For the active stream the mode will be set instantly.
Parameters:
-
Name Type Description streamIdnumber The audio stream identifier.
channelModeToiMediaPlayerBase.ToiAudioChannelMode The audio channel mode.
Throws:
-
ToiSessionViolationException If the player is in ToiMediaPlayerBase.STATE_IDLE a session violation exception is raised.
ToiInvalidArgumentException An invalid argument exception is raised if the stream identifier argument does not identify a valid audio stream or the channel mode is not supported.
This function sets the values of multiple parameters at once. Depending on the current state, the new values are used differently. If the function is called when in idle state, the new values are used for all sessions started after the parameters are set. If the function is called in any other state but the idle state, the new values are applied to that session only and are discarded automatically when the session ends. If an exception is raised, no parameters will be set.
Parameters:
-
Name Type Description parametersArray.<ToiMediaSession.ToiParameter> A list of parameters with name and value.
Throws:
-
ToiInvalidArgumentException Raised if an empty string is used as parameter name or a parameter value exceeds the maximum size.
ToiPermissionDeniedException Raised if attempting to set an internal parameter.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
This function makes the application subscribe to updates of the given list of parameters. The first time an application subscribes to a specific parameter there will be an immediate ToiMediaPlayerParameterChangedEvent notification if the parameter already has a value.
Inherited From:
See also:
Parameters:
-
Name Type Description eventListenerToiEventListener The eventListener that has been registered.
namesArray.<ToiMediaSession.ToiParameterName> The names of the parameters for which change the application wants to subscribe to.
Throws:
-
ToiInvalidArgumentException Raised if the address name is invalid or not registered.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
This function is used to remove multiple parameters at once. If the function is called when in idle state, the parameters are removed for all sessions which start after the parameters are removed. If the function is called in any other state but the idle state, the parameters are removed for that session only. If an exception is raised, no parameters will be removed.
Parameters:
-
Name Type Description namesArray.<ToiMediaSession.ToiParameterName> A list of names of parameters to be removed.
Throws:
-
ToiInvalidArgumentException Raised if an empty string is used as parameter name.
ToiPermissionDeniedException Raised if attempting to unset an internal parameter.
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.
This function undoes the effect of a previous call to ToiMediaPlayerBase#subscribeParameters. Any parameters that has not been subscribed to will simply be ignored.
Inherited From:
See also:
Parameters:
-
Name Type Description eventListenerToiEventListener The eventListener that has been registered.
namesArray.<ToiMediaSession.ToiParameterName> The names of the parameters that the application is no longer interested in.
Throws:
-
ToiInvalidArgumentException Raised if the address name is invalid or not registered
ToiUnavailableException Raised if the player is temporarily unavailable due to platform resource management.