Method Summary
| createPlayerInstance ( ) → ToiMediaPlayer | Creates a new media player, and associates it with the calling application. |
| enumeratePlayers ( ) → Array.<ToiMediaService.ToiPlayerInfo> |
This method returns a list of all active players |
|
openSession
(
|
Opens an existing session. |
|
subscribeType
(
|
Subscribes to status notifications. |
|
unsubscribeType
(
|
This method removes a listener which has been previously subscribed to status information. |
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. |
|
removeEventListener
(
|
This method removes an event listener for a specific event. |
Type Definitions
|
Identifier that uniquely identifies an asset. ToiAssetManagerService.ToiAssetId |
|
|
|
|
|
This enumeration defines the different Player types. |
|
Methods
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 creates a new media player and associates it with the calling application.
When the application no longer needs the media player, it must release it by calling ToiMediaPlayer#releaseInstance. This will return the underlying resources to the system.
See also:
Throws:
-
ToiInvalidArgumentException Raised if the specified application identifier is invalid.
ToiNotEnoughResourcesException Raised if a new player instance cannot be created due to lack of system resources.
ToiPermissionDeniedException Raised if the calling application is not allowed to create instances of the media player. This restriction applies to popup applications.
Returns:
-
Type: ToiMediaPlayer
The address to the ToiMediaPlayer instance.
This method returns a list of all active players
Returns:
-
Type: Array.<ToiMediaService.ToiPlayerInfo>
Sequence of players.
Opens an existing session. Each call to this method returns the address of a unique object that must be released when no longer needed, by calling ToiMediaSession#releaseInstance.
Note that the actual session does not necessarily have to be owned by the application calling this function. It may still be used by the owner to access the functionality of the ToiMediaSession interface.
See also:
Parameters:
-
Name Type Description sessionIdToiMediaSession.ToiSessionId The identifier of the session.
Throws:
-
ToiInvalidArgumentException Raised if the session identifier does not identify an existing session. Note that all applications must be designed to handle this exception since sessions can be closed at any time, rendering the session identifier invalid.
Returns:
-
Type: ToiMediaSession
The address of the new session object which is mapped to the requested session. The session object implements the ToiMediaSession interface.
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 method lets the application subscribe to notifications about changes in sessions of a particular type.
See also:
Parameters:
-
Name Type Description eventListenerToiEventListener The eventListener that has been registered.
typeToiMediaSession.ToiSessionType The session type.
Throws:
-
ToiInvalidArgumentException If the parameter name is invalid or not recognized an invalid argument exception is raised.
This method removes a listener which has been previously subscribed to status information.
See also:
Parameters:
-
Name Type Description eventListenerToiEventListener The eventListener that has been registered.
typeToiMediaSession.ToiSessionType The session type.
Throws:
-
ToiInvalidArgumentException If the parameter name is invalid or not recognized an invalid argument exception is raised.
Members
This is an Event identifier for ToiMediaPlayerStatusChangedEvent.
This notification is sent whenever a player changes its state.
This is an Event identifier for ToiMediaSessionStateChangedEvent.
This notification is sent when a session is changing state. A new session will initially be in state ToiMediaSession.STATE_CONNECTING while a closed session will be in state ToiMediaSession.STATE_CLOSED.
This is an Event identifier for ToiMediaSessionStreamInfoChangedEvent.
This notification is sent when new information about a stream handled by a session is available.
Audio Player type.
Main Player type.
Picture-In-Picture Player type.
Information about the media player.
Struct fields
| Name | Description |
|---|---|
| reason | The reason for the state change. Type: string |
| sessionId | The session identifier. Type: ToiMediaSession.ToiSessionId |
| state | The current player state. Type: ToiMediaPlayerBase.ToiState |
| type | Player Type. Type: ToiMediaService.ToiPlayerType |
| url | The source URL for the media player. Type: string |
Information about a media session.
Struct fields
| Name | Description |
|---|---|
| id | The session identifier. Type: ToiMediaSession.ToiSessionId |
| reason | The reason for the state change. Type: string |
| state | The current session state. Type: ToiMediaSession.ToiState |
| type | Bitmask for the types of the session, e.g. player and recorder types when the session is used for time shifting. Constants for the possible types are available in ToiMediaSession. Type: ToiMediaSession.ToiSessionType |
| url | The source URL for the session. Type: string |