Method Summary
| createConfigurationSession ( ) → ToiAudioOutputConfigurationSession | Creates a session for changing the audio output configuration. |
| getConfiguration ( ) → ToiAudioOutputConfiguration |
Returns the audio output configuration. |
| getConnections ( ) → Array.<ToiAudioOutputService.ToiAudioConnectionDescriptor> |
Returns available audio connections. |
|
getLatency
(
|
Returns the audio latency of a connection. |
| getMasterVolume ( ) → level | Returns the master volume of the system, in the range 0-100. |
|
getMuteState
(
|
Returns the mutes state of a connection. |
|
getVolume
(
|
Returns the volume level of a connection, in the range 0-100. |
|
setLatency
(
|
Sets the latency for an audio connection in milliseconds. |
|
setMasterVolume
(
|
Sets the master audio volume. Range 0-100. |
|
setMuteState
(
|
Sets the mute state of a connection. |
|
setVolume
(
|
Sets the volume for a connection. Range 0-100. |
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
|
Input or output connection direction. |
|
|
Audio connection identifier type. |
|
|
|
|
|
Audio connection types. |
|
Events
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.
Creates and returns a session to change the audio output configuration. The session is active between this call and either ToiAudioOutputConfigurationSession#apply or ToiAudioOutputConfigurationSession#revert.
Throws:
-
ToiInvalidArgumentException Raised if the application identifier is invalid.
ToiInvalidPreconditionException Raised if another session is active.
Returns:
-
Type: ToiAudioOutputConfigurationSession
The ToiAudioOutputConfigurationSession address.
Returns the audio output configuration.
Returns:
-
Type: ToiAudioOutputConfiguration
The ToiAudioOutputConfiguration address.
Returns available audio connections.
Returns:
-
Type: Array.<ToiAudioOutputService.ToiAudioConnectionDescriptor>
The list available audio connections.
Returns the audio latency of a connection.
Technical Preview:
- This method is a TECHNICAL PREVIEW, it may change.
Parameters:
-
Name Type Description connectionIdToiAudioOutputService.ToiAudioConnectionId The identifier of the connection to query.
Throws:
-
ToiInvalidArgumentException Raised if there is no such connection.
ToiOperationNotSupportedException Raised if the latency for the connection is not adjustable.
Returns:
-
Type: number
The audio latency in milliseconds.
Returns the master audio volume level of the system. Possible level range from 0 and 100 where 0 is the lowest volume and 100 the highest volume.
See ToiAudioOutputService#setMasterVolume for a description of what connection(s) are used for the master volume. If multiple connections are used the value of one will be returned. The one used will be the HDMI connection if available, otherwise the analog connection, otherwise the first one found.
If ToiAudioOutputService#setVolume has been used to modify the individual levels of connections since the last call to ToiAudioOutputService#setMasterVolume the value might not be the actual level used on all output connections.
If the master volume could be set on the decoder input the value returned will be calculated by scaling the decoder volume level using the output volume of the output most likely to be connected, that is the same as the one that had been used if decoder was not adjustable, HDMI if available, otherwise analog, otherwise the first one found.
Throws:
-
ToiInvalidArgumentException Raised if the application identifier is invalid.
ToiOperationNotSupportedException Raised if it was not possible to find any adjustable connections.
Returns:
-
Type: number
The volume level.
Returns the mutes state of a connection.
Parameters:
-
Name Type Description connectionIdToiAudioOutputService.ToiAudioConnectionId The identifier of the connection to query.
Throws:
-
ToiInvalidArgumentException Raised if there is no such connection.
ToiOperationNotSupportedException Raised if the connection is not mutable.
Returns:
-
Type: boolean
The mute state.
Returns the audio volume level of a connection. Possible level range from 0 and 100 where 0 is the lowest volume and 100 the highest volume.
Parameters:
-
Name Type Description connectionIdToiAudioOutputService.ToiAudioConnectionId The identifier of the connection to query.
Throws:
-
ToiInvalidArgumentException Raised if there is no such connection.
ToiOperationNotSupportedException Raised if the volume for the connection is not adjustable.
Returns:
-
Type: number
The volume level.
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.
Set an audio connection audio latency. latency is in milliseconds. This should affect all audio formats. If the latency parameter is out of range, the closest supported value is set. Setting the latency for one connection may impact the latency for other connections. In this case, the ToiAudioOutputLatencyChangedEvent will be notified on the impacted connections.
Technical Preview:
- This method is a TECHNICAL PREVIEW, it may change.
Parameters:
-
Name Type Description connectionIdToiAudioOutputService.ToiAudioConnectionId The identifier of the connection for which the audio latency will be changed.
latencynumber The desired audio latency in milliseconds.
Throws:
-
ToiInvalidArgumentException Raised if there is no such connection.
ToiOperationNotSupportedException Raised if the latency for the connection is not adjustable.
Set the master audio output volume. The level can be adjusted between 0 and 100 where 0 is the lowest volume and 100 the highest volume.
This will affect the volume on one or more audio connections depending on platform and hardware capabilities. If possible the volume will be adjusted on the decoder connection, because a change there will automatically affect all audio outputs. This will also set all adjustable output connections to 100 (maximum volume). If the decoder volume connection is not adjustable the volume will instead be applied to all outputs that are adjustable.
Not all audio might be affected by changing the master volume. Any passthrough audio will not be affected by volume adjustments.
ToiAudioOutputVolumeChangedEvent will be notified on the impacted connections, followed one call to ToiAudioOutputMasterVolumeChangedEvent.
This method will override previous calls to ToiAudioOutputService#setVolume on individual channels.
Parameters:
-
Name Type Description levelnumber The desired volume level.
Throws:
-
ToiInvalidArgumentException Raised if the application identifier is invalid or the level is outside the allowed interval.
ToiOperationNotSupportedException Raised if it was not possible to find any adjustable connections.
Sets the mute state of a connection.
Parameters:
-
Name Type Description connectionIdToiAudioOutputService.ToiAudioConnectionId The identifier of the connection to query.
stateboolean The desired mute state.
Throws:
-
ToiInvalidArgumentException Raised if there is no such connection.
ToiOperationNotSupportedException Raised if the connection is not mutable or it is currently enforced to mute due to DRM restriction.
Set an audio connection volume level. The level can be adjusted between 0 and 100 where 0 is the lowest volume and 100 the highest volume. The volume is only affected if the content is decoded or non compressed.
ToiAudioOutputVolumeChangedEvent will be notified.
If the connection is one that will be used in calculating the returned level for ToiAudioOutputService#getMasterVolume ToiAudioOutputMasterVolumeChangedEvent will be notified. It is possible that the experienced end-user volume will be modified even if changing the volume on other connections.
Parameters:
-
Name Type Description connectionIdToiAudioOutputService.ToiAudioConnectionId The identifier of the connection for which the volume will be changed.
levelnumber The desired volume level.
Throws:
-
ToiInvalidArgumentException Raised if there is no such connection or if the level is outside the allowed interval.
ToiOperationNotSupportedException Raised if the volume for the connection is not adjustable.
Members
This is an Event identifier for ToiAudioOutputConfigurationChangedEvent.
Called when the audio output configuration has changed.
This is an Event identifier for ToiAudioOutputLatencyChangedEvent.
Called when the audio latency of the specified connection has changed.
This is an Event identifier for ToiAudioOutputMasterVolumeChangedEvent.
Called when the master volume has changed.
This is an Event identifier for ToiAudioOutputMuteStateChangedEvent.
Called when the mute state of the specified connection has changed.
This is an Event identifier for ToiAudioOutputVolumeChangedEvent.
Called when the volume level of the specified connection has changed.
The connection is an input.
The connection is an output.
Analog connection.
Memory buffer connection, one of the inputs to the audio mixer. If audio overlay is supported, it is stored in this memory buffer.
Decoder connection, one of the inputs to the audio mixer. If digital audio is decoded to PCM it is done by the decoder.
HDMI connection.
I2S connection.
S/PDIF connection.
Audio connection descriptor.
Struct fields
| Name | Description |
|---|---|
| direction | The connection direction. Type: ToiAudioOutputService.ToiAudioConnectionDirection |
| id | A unique identifier among all connections. Type: ToiAudioOutputService.ToiAudioConnectionId |
| index | An incrementing index, starting with 0, which is unique for each type and direction combination Type: number |
| isAdjustable | If true, the volume can be adjusted. Type: boolean |
| isLatencyAdjustable | If true, the audio latency can be adjusted. Type: boolean |
| isMutable | If true, the mute state can be altered. Type: boolean |
| type | The connection type. Type: ToiAudioOutputService.ToiAudioConnectionType |