Session
abstract class Session : KeyEvent.Callback
kotlin.Any | |
↳ | android.media.tv.interactive.TvInteractiveAppService.Session |
Base class for derived classes to implement to provide a TV interactive app session.
A session is associated with a TvInteractiveAppView
instance and handles corresponding communications. It also handles the communications with android.media.tv.TvInputService.Session
if connected.
Summary
Public constructors | |
---|---|
Creates a new Session. |
Public methods | |
---|---|
open Boolean |
Returns |
open Unit |
layoutSurface(left: Int, top: Int, right: Int, bottom: Int) Assigns a size and position to the surface passed in |
open Unit |
notifyAdBufferReady(buffer: AdBuffer) Notifies when the advertisement buffer is filled and ready to be read. |
Unit |
notifyBiInteractiveAppCreated(biIAppUri: Uri, biIAppId: String?) Notifies the broadcast-independent(BI) interactive application has been created. |
open Unit |
notifySessionStateChanged(state: Int, err: Int) Notifies when the session state is changed. |
Unit |
notifyTeletextAppStateChanged(state: Int) Notifies when the digital teletext app state is changed. |
open Unit |
onAdBufferConsumed(buffer: AdBuffer) Called when an advertisement buffer is consumed. |
open Unit |
onAdResponse(response: AdResponse) Called when an advertisement response is received. |
open Unit |
onAvailableSpeeds(speeds: FloatArray) Receives available playback speeds. |
open Unit |
onBroadcastInfoResponse(response: BroadcastInfoResponse) Called when a broadcast info response is received. |
open Unit |
Called when content is allowed. |
open Unit |
onContentBlocked(rating: TvContentRating) Called when content is blocked. |
open Unit |
onCreateBiInteractiveAppRequest(biIAppUri: Uri, params: Bundle?) Creates broadcast-independent(BI) interactive application. |
open View? |
Called when the application requests to create an media view. |
open Unit |
onCurrentChannelLcn(lcn: Int) Receives logical channel number (LCN) of current channel. |
open Unit |
onCurrentChannelUri(channelUri: Uri?) Receives current channel URI. |
open Unit |
onCurrentTvInputId(inputId: String?) Receives current TV input ID. |
open Unit |
onCurrentVideoBounds(bounds: Rect) Receives current video bounds. |
open Unit |
onDestroyBiInteractiveAppRequest(biIAppId: String) Destroys broadcast-independent(BI) interactive application. |
open Unit |
Called when the application sends information of an error. |
open Boolean |
onGenericMotionEvent(event: MotionEvent) Implement this method to handle generic motion events on the current session. |
open Boolean |
Called when a key down event has occurred. |
open Boolean |
onKeyLongPress(keyCode: Int, event: KeyEvent) Called when a long press has occurred. |
open Boolean |
onKeyMultiple(keyCode: Int, count: Int, event: KeyEvent) Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession. |
open Boolean |
Called when a key up event has occurred. |
open Unit |
onMediaViewSizeChanged(width: Int, height: Int) Called when the size of the media view is changed by the application. |
open Unit |
onRecordingConnectionFailed(recordingId: String, inputId: String) This is called when an error occurred while establishing a connection to the recording session for the corresponding TV input. |
open Unit |
onRecordingDisconnected(recordingId: String, inputId: String) This is called when the connection to the current recording session is lost. |
open Unit |
onRecordingError(recordingId: String, err: Int) This is called when an issue has occurred. |
open Unit |
onRecordingScheduled(recordingId: String, requestId: String?) This is called when the recording has been scheduled. |
open Unit |
onRecordingStarted(recordingId: String, requestId: String?) This is called when a recording has been started. |
open Unit |
onRecordingStopped(recordingId: String) This is called when the recording has been stopped. |
open Unit |
onRecordingTuned(recordingId: String, channelUri: Uri) This is called when the recording session has been tuned to the given channel and is ready to start recording. |
abstract Unit |
Releases TvInteractiveAppService session. |
open Unit |
Resets TvInteractiveAppService session. |
abstract Boolean |
onSetSurface(surface: Surface?) Called when the application sets the surface. |
open Unit |
onSetTeletextAppEnabled(enable: Boolean) To toggle Digital Teletext Application if there is one in AIT app list. |
open Unit |
onSignalStrength(strength: Int) Called when signal strength is changed. |
open Unit |
onSigningResult(signingId: String, result: ByteArray) Receives signing result. |
open Unit |
Starts TvInteractiveAppService session. |
open Unit |
Stops TvInteractiveAppService session. |
open Unit |
onStreamVolume(volume: Float) Receives current stream volume. |
open Unit |
onSurfaceChanged(format: Int, width: Int, height: Int) Called after any structural changes (format or size) have been made to the surface passed in |
open Unit |
onTimeShiftCurrentPositionChanged(inputId: String, timeMs: Long) Called when time shift current position is changed. |
open Unit |
onTimeShiftMode(mode: Int) Receives current time shift mode. |
open Unit |
onTimeShiftPlaybackParams(params: PlaybackParams) Called when the time shift |
open Unit |
onTimeShiftStartPositionChanged(inputId: String, timeMs: Long) Called when time shift start position is changed. |
open Unit |
onTimeShiftStatusChanged(inputId: String, status: Int) Called when time shift status is changed. |
open Boolean |
onTouchEvent(event: MotionEvent) Implement this method to handle touch screen motion events on the current session. |
open Unit |
onTrackInfoList(tracks: MutableList<TvTrackInfo!>) Receives track list. |
open Unit |
onTrackSelected(type: Int, trackId: String) Called when the corresponding TV input selected to a track. |
open Boolean |
onTrackballEvent(event: MotionEvent) Implement this method to handle trackball events on the current session. |
open Unit |
onTracksChanged(tracks: MutableList<TvTrackInfo!>) Called when the tracks are changed. |
open Unit |
Called when the corresponding TV input tuned to a channel. |
open Unit |
onTvMessage(type: Int, data: Bundle) Called when a TV message is received |
open Unit |
onTvRecordingInfo(recordingInfo: TvRecordingInfo?) Receives the requested |
open Unit |
onTvRecordingInfoList(recordingInfoList: MutableList<TvRecordingInfo!>) Receives requested recording info list. |
open Unit |
Called when video is available. |
open Unit |
Called when video is unavailable. |
open Unit |
removeBroadcastInfo(requestId: Int) Remove broadcast information request from the related TV input. |
open Unit |
Sends an advertisement request to be processed by the related TV input. |
open Unit |
Requests available speeds for time shift. |
open Unit |
requestBroadcastInfo(request: BroadcastInfoRequest) Requests broadcast related information from the related TV input. |
open Unit |
Requests the logic channel number (LCN) of the current channel. |
open Unit |
Requests the URI of the current channel. |
open Unit |
Requests current TV input ID. |
open Unit |
Requests the bounds of the current video. |
open Unit |
requestScheduleRecording(requestId: String, inputId: String, channelUri: Uri, programUri: Uri, params: Bundle) Requests scheduling of a recording. |
open Unit |
requestScheduleRecording(requestId: String, inputId: String, channelUri: Uri, startTime: Long, duration: Long, repeatDays: Int, params: Bundle) Requests scheduling of a recording. |
open Unit |
requestSigning(signingId: String, algorithm: String, alias: String, data: ByteArray) Requests signing of the given data. |
open Unit |
requestStartRecording(requestId: String, programUri: Uri?) Requests starting of recording |
open Unit |
requestStopRecording(recordingId: String) Requests the recording associated with the recordingId to stop. |
open Unit |
Requests stream volume. |
open Unit |
Requests time shift mode. |
open Unit |
Requests the list of |
open Unit |
requestTvRecordingInfo(recordingId: String) Gets the recording info for the specified recording |
open Unit |
requestTvRecordingInfoList(type: Int) Gets a list of |
open Unit |
sendPlaybackCommandRequest(cmdType: String, parameters: Bundle?) Sends a specific playback command to be processed by the related TV input. |
open Unit |
sendTimeShiftCommandRequest(cmdType: String, parameters: Bundle?) Sends a specific time shift command to be processed by the related TV input. |
open Unit |
setMediaViewEnabled(enable: Boolean) Enables or disables the media view. |
open Unit |
setTvRecordingInfo(recordingId: String, recordingInfo: TvRecordingInfo) Sets the recording info for the specified recording |
open Unit |
setVideoBounds(rect: Rect) Sets broadcast video bounds. |
Public constructors
Session
Session(context: Context)
Creates a new Session.
Parameters | |
---|---|
context |
Context: The context of the application This value cannot be null . |
Public methods
isMediaViewEnabled
open fun isMediaViewEnabled(): Boolean
Returns true
if media view is enabled, false
otherwise.
See Also
layoutSurface
open fun layoutSurface(
left: Int,
top: Int,
right: Int,
bottom: Int
): Unit
Assigns a size and position to the surface passed in onSetSurface
. The position is relative to the overlay view that sits on top of this surface.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
left |
Int: Left position in pixels, relative to the overlay view. |
top |
Int: Top position in pixels, relative to the overlay view. |
right |
Int: Right position in pixels, relative to the overlay view. |
bottom |
Int: Bottom position in pixels, relative to the overlay view. |
notifyAdBufferReady
open fun notifyAdBufferReady(buffer: AdBuffer): Unit
Notifies when the advertisement buffer is filled and ready to be read.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
buffer |
AdBuffer: The AdBuffer to be received This value cannot be null . |
notifyBiInteractiveAppCreated
fun notifyBiInteractiveAppCreated(
biIAppUri: Uri,
biIAppId: String?
): Unit
Notifies the broadcast-independent(BI) interactive application has been created.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
biIAppId |
String?: BI interactive app ID, which can be used to destroy the BI interactive app. null if it's not created successfully. |
biIAppUri |
Uri: This value cannot be null . |
notifySessionStateChanged
open fun notifySessionStateChanged(
state: Int,
err: Int
): Unit
Notifies when the session state is changed.
If you override this method you must call through to the superclass implementation.
notifyTeletextAppStateChanged
fun notifyTeletextAppStateChanged(state: Int): Unit
Notifies when the digital teletext app state is changed.
If you override this method you must call through to the superclass implementation.
onAdBufferConsumed
open fun onAdBufferConsumed(buffer: AdBuffer): Unit
Called when an advertisement buffer is consumed.
Parameters | |
---|---|
buffer |
AdBuffer: The AdBuffer that was consumed. This value cannot be null . |
onAdResponse
open fun onAdResponse(response: AdResponse): Unit
Called when an advertisement response is received.
Parameters | |
---|---|
response |
AdResponse: This value cannot be null . |
onAvailableSpeeds
open fun onAvailableSpeeds(speeds: FloatArray): Unit
Receives available playback speeds.
Parameters | |
---|---|
speeds |
FloatArray: An ordered array of playback speeds, expressed as values relative to the normal playback speed (1.0), at which the current content can be played as a time-shifted broadcast. This is an empty array if the supported playback speeds are unknown or the video/broadcast is not in time shift mode. If currently in time shift mode, this array will normally include at least the values 1.0 (normal speed) and 0.0 (paused). This value cannot be null . |
onBroadcastInfoResponse
open fun onBroadcastInfoResponse(response: BroadcastInfoResponse): Unit
Called when a broadcast info response is received.
Parameters | |
---|---|
response |
BroadcastInfoResponse: This value cannot be null . |
onContentAllowed
open fun onContentAllowed(): Unit
Called when content is allowed.
onContentBlocked
open fun onContentBlocked(rating: TvContentRating): Unit
Called when content is blocked.
Parameters | |
---|---|
rating |
TvContentRating: This value cannot be null . |
onCreateBiInteractiveAppRequest
open fun onCreateBiInteractiveAppRequest(
biIAppUri: Uri,
params: Bundle?
): Unit
Creates broadcast-independent(BI) interactive application.
The implementation should call notifyBiInteractiveAppCreated(android.net.Uri,java.lang.String)
, no matter if it's created successfully or not.
Parameters | |
---|---|
biIAppUri |
Uri: This value cannot be null . |
params |
Bundle?: This value may be null . |
onCreateMediaView
open fun onCreateMediaView(): View?
Called when the application requests to create an media view. Each session implementation can override this method and return its own view.
Return | |
---|---|
View? |
a view attached to the media window This value may be null . |
onCurrentChannelLcn
open fun onCurrentChannelLcn(lcn: Int): Unit
Receives logical channel number (LCN) of current channel.
onCurrentChannelUri
open fun onCurrentChannelUri(channelUri: Uri?): Unit
Receives current channel URI.
Parameters | |
---|---|
channelUri |
Uri?: This value may be null . |
onCurrentTvInputId
open fun onCurrentTvInputId(inputId: String?): Unit
Receives current TV input ID.
Parameters | |
---|---|
inputId |
String?: This value may be null . |
onCurrentVideoBounds
open fun onCurrentVideoBounds(bounds: Rect): Unit
Receives current video bounds.
Parameters | |
---|---|
bounds |
Rect: the rectangle area for rendering the current video. This value cannot be null . |
onDestroyBiInteractiveAppRequest
open fun onDestroyBiInteractiveAppRequest(biIAppId: String): Unit
Destroys broadcast-independent(BI) interactive application.
Parameters | |
---|---|
biIAppId |
String: the BI interactive app ID from onCreateBiInteractiveAppRequest(android.net.Uri,android.os.Bundle) This value cannot be null . |
onError
open fun onError(
errMsg: String,
params: Bundle
): Unit
Called when the application sends information of an error.
Parameters | |
---|---|
errMsg |
String: the message of the error. This value cannot be null . |
params |
Bundle: additional parameters of the error. For example, the signingId of android.media.tv.interactive.TvInteractiveAppView.TvInteractiveAppCallback#onRequestSigning(java.lang.String,java.lang.String,java.lang.String,java.lang.String,byte[]) can be included to identify the related signing request, and the method name "onRequestSigning" can also be added to the params. This value cannot be null . |
onGenericMotionEvent
open fun onGenericMotionEvent(event: MotionEvent): Boolean
Implement this method to handle generic motion events on the current session.
Parameters | |
---|---|
event |
MotionEvent: The motion event being received. This value cannot be null . |
Return | |
---|---|
Boolean |
If you handled the event, return true . If you want to allow the event to be handled by the next receiver, return false . |
onKeyDown
open fun onKeyDown(
keyCode: Int,
event: KeyEvent
): Boolean
Called when a key down event has occurred. If you return true, you can first call KeyEvent.startTracking()
to have the framework track the event through its onKeyUp(int,android.view.KeyEvent)
and also call your onKeyLongPress(int,android.view.KeyEvent)
if it occurs.
Parameters | |
---|---|
keyCode |
Int: The value in event.getKeyCode(). |
event |
KeyEvent: This value cannot be null . |
Return | |
---|---|
Boolean |
If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. |
onKeyLongPress
open fun onKeyLongPress(
keyCode: Int,
event: KeyEvent
): Boolean
Called when a long press has occurred. If you return true, the final key up will have KeyEvent#FLAG_CANCELED
and KeyEvent#FLAG_CANCELED_LONG_PRESS
set. Note that in order to receive this callback, someone in the event change must return true from onKeyDown
and call KeyEvent#startTracking()
on the event.
Parameters | |
---|---|
keyCode |
Int: The value in event.getKeyCode(). |
event |
KeyEvent: This value cannot be null . |
Return | |
---|---|
Boolean |
If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. |
onKeyMultiple
open fun onKeyMultiple(
keyCode: Int,
count: Int,
event: KeyEvent
): Boolean
Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession.
Parameters | |
---|---|
keyCode |
Int: The value in event.getKeyCode(). |
count |
Int: Number of pairs as returned by event.getRepeatCount(). |
event |
KeyEvent: This value cannot be null . |
Return | |
---|---|
Boolean |
If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. |
onKeyUp
open fun onKeyUp(
keyCode: Int,
event: KeyEvent
): Boolean
Called when a key up event has occurred.
Parameters | |
---|---|
keyCode |
Int: The value in event.getKeyCode(). |
event |
KeyEvent: This value cannot be null . |
Return | |
---|---|
Boolean |
If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. |
onMediaViewSizeChanged
open fun onMediaViewSizeChanged(
width: Int,
height: Int
): Unit
Called when the size of the media view is changed by the application.
This is always called at least once when the session is created regardless of whether the media view is enabled or not. The media view container size is the same as the containing TvInteractiveAppView
. Note that the size of the underlying surface can be different if the surface was changed by calling layoutSurface
.
Parameters | |
---|---|
width |
Int: The width of the media view, in pixels. The units of this value are pixels. |
height |
Int: The height of the media view, in pixels. The units of this value are pixels. |
onRecordingConnectionFailed
open fun onRecordingConnectionFailed(
recordingId: String,
inputId: String
): Unit
This is called when an error occurred while establishing a connection to the recording session for the corresponding TV input.
Parameters | |
---|---|
recordingId |
String: The ID of the related recording which is sent via TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null . |
inputId |
String: The ID of the TV input bound to the current TvRecordingClient. This value cannot be null . |
onRecordingDisconnected
open fun onRecordingDisconnected(
recordingId: String,
inputId: String
): Unit
This is called when the connection to the current recording session is lost.
Parameters | |
---|---|
recordingId |
String: The ID of the related recording which is sent via TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null . |
inputId |
String: The ID of the TV input bound to the current TvRecordingClient. This value cannot be null . |
onRecordingError
open fun onRecordingError(
recordingId: String,
err: Int
): Unit
This is called when an issue has occurred. It may be called at any time after the current recording session is created until it is released.
Parameters | |
---|---|
recordingId |
String: The ID of the related recording which is sent via TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null . |
err |
Int: The error code. Should be one of the following.
android.media.tv.TvInputManager#RECORDING_ERROR_UNKNOWN , android.media.tv.TvInputManager#RECORDING_ERROR_INSUFFICIENT_SPACE , or android.media.tv.TvInputManager#RECORDING_ERROR_RESOURCE_BUSY |
onRecordingScheduled
open fun onRecordingScheduled(
recordingId: String,
requestId: String?
): Unit
This is called when the recording has been scheduled.
Parameters | |
---|---|
recordingId |
String: The ID assigned to this recording by the app. It can be used to send recording related requests such as requestStopRecording(java.lang.String) . This value cannot be null . |
requestId |
String?: The ID of the request when #requestScheduleRecording is called. null if the recording is not triggered by a request. This ID should be created by the TvInteractiveAppService and can be any string. |
onRecordingStarted
open fun onRecordingStarted(
recordingId: String,
requestId: String?
): Unit
This is called when a recording has been started.
When a scheduled recording is started, this is also called, and the request ID in this case is null
.
Parameters | |
---|---|
recordingId |
String: The ID of the recording started. The TV app should provide and maintain this ID to identify the recording in the future. This value cannot be null . |
requestId |
String?: The ID of the request when requestStartRecording(java.lang.String,android.net.Uri) is called. null if the recording is not triggered by a requestStartRecording(java.lang.String,android.net.Uri) request. This ID should be created by the TvInteractiveAppService and can be any string. |
See Also
onRecordingStopped
open fun onRecordingStopped(recordingId: String): Unit
This is called when the recording has been stopped.
Parameters | |
---|---|
recordingId |
String: The ID of the recording stopped. This ID is created and maintained by the TV app when the recording was started. This value cannot be null . |
See Also
onRecordingTuned
open fun onRecordingTuned(
recordingId: String,
channelUri: Uri
): Unit
This is called when the recording session has been tuned to the given channel and is ready to start recording.
Parameters | |
---|---|
recordingId |
String: The ID of the related recording which is sent via TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null . |
channelUri |
Uri: The URI of the tuned channel. This value cannot be null . |
onRelease
abstract fun onRelease(): Unit
Releases TvInteractiveAppService session.
onResetInteractiveApp
open fun onResetInteractiveApp(): Unit
Resets TvInteractiveAppService session.
onSetSurface
abstract fun onSetSurface(surface: Surface?): Boolean
Called when the application sets the surface.
The TV Interactive App service should render interactive app UI onto the given surface. When called with null
, the Interactive App service should immediately free any references to the currently set surface and stop using it.
Parameters | |
---|---|
surface |
Surface?: The surface to be used for interactive app UI rendering. Can be null . |
Return | |
---|---|
Boolean |
true if the surface was set successfully, false otherwise. |
onSetTeletextAppEnabled
open fun onSetTeletextAppEnabled(enable: Boolean): Unit
To toggle Digital Teletext Application if there is one in AIT app list.
Parameters | |
---|---|
enable |
Boolean: true to enable teletext app; false otherwise. |
onSignalStrength
open fun onSignalStrength(strength: Int): Unit
Called when signal strength is changed.
Parameters | |
---|---|
strength |
Int: Value is android.media.tv.TvInputManager#SIGNAL_STRENGTH_LOST , android.media.tv.TvInputManager#SIGNAL_STRENGTH_WEAK , or android.media.tv.TvInputManager#SIGNAL_STRENGTH_STRONG |
onSigningResult
open fun onSigningResult(
signingId: String,
result: ByteArray
): Unit
Receives signing result.
Parameters | |
---|---|
signingId |
String: the ID to identify the request. It's the same as the corresponding ID in Session#requestSigning(String, String, String, byte[]) This value cannot be null . |
result |
ByteArray: the signed result. This value cannot be null . |
onStartInteractiveApp
open fun onStartInteractiveApp(): Unit
Starts TvInteractiveAppService session.
onStopInteractiveApp
open fun onStopInteractiveApp(): Unit
Stops TvInteractiveAppService session.
onStreamVolume
open fun onStreamVolume(volume: Float): Unit
Receives current stream volume.
Parameters | |
---|---|
volume |
Float: a volume value between 0.0f and 1.0f , inclusive. |
onSurfaceChanged
open fun onSurfaceChanged(
format: Int,
width: Int,
height: Int
): Unit
Called after any structural changes (format or size) have been made to the surface passed in onSetSurface
. This method is always called at least once, after onSetSurface
is called with non-null surface.
Parameters | |
---|---|
format |
Int: The new PixelFormat of the surface. Value is android.graphics.PixelFormat#RGBA_8888 , android.graphics.PixelFormat#RGBX_8888 , android.graphics.PixelFormat#RGBA_F16 , android.graphics.PixelFormat#RGBA_1010102 , android.graphics.PixelFormat#RGB_888 , android.graphics.PixelFormat#RGB_565 , or android.graphics.PixelFormat.R_8 |
width |
Int: The new width of the surface. |
height |
Int: The new height of the surface. |
onTimeShiftCurrentPositionChanged
open fun onTimeShiftCurrentPositionChanged(
inputId: String,
timeMs: Long
): Unit
Called when time shift current position is changed.
Parameters | |
---|---|
inputId |
String: The ID of the input for which the time shift current position has changed. This value cannot be null . |
timeMs |
Long: The current position for time shifting, in milliseconds since the epoch. |
onTimeShiftMode
open fun onTimeShiftMode(mode: Int): Unit
Receives current time shift mode.
Parameters | |
---|---|
mode |
Int: The current time shift mode. The value is one of the following: TvInputManager#TIME_SHIFT_MODE_OFF , TvInputManager#TIME_SHIFT_MODE_LOCAL , TvInputManager#TIME_SHIFT_MODE_NETWORK , TvInputManager#TIME_SHIFT_MODE_AUTO . Value is android.media.tv.TvInputManager#TIME_SHIFT_MODE_OFF , android.media.tv.TvInputManager#TIME_SHIFT_MODE_LOCAL , android.media.tv.TvInputManager#TIME_SHIFT_MODE_NETWORK , or android.media.tv.TvInputManager#TIME_SHIFT_MODE_AUTO |
onTimeShiftPlaybackParams
open fun onTimeShiftPlaybackParams(params: PlaybackParams): Unit
Called when the time shift android.media.PlaybackParams
is set or changed.
Parameters | |
---|---|
params |
PlaybackParams: The new PlaybackParams that was set or changed. This value cannot be null . |
onTimeShiftStartPositionChanged
open fun onTimeShiftStartPositionChanged(
inputId: String,
timeMs: Long
): Unit
Called when time shift start position is changed.
Parameters | |
---|---|
inputId |
String: The ID of the input for which the time shift start position has changed. This value cannot be null . |
timeMs |
Long: The start position for time shifting, in milliseconds since the epoch. |
onTimeShiftStatusChanged
open fun onTimeShiftStatusChanged(
inputId: String,
status: Int
): Unit
Called when time shift status is changed.
Parameters | |
---|---|
inputId |
String: The ID of the input for which the time shift status has changed. This value cannot be null . |
status |
Int: The status of which the input has changed to. Should be one of the following.
android.media.tv.TvInputManager#TIME_SHIFT_STATUS_UNKNOWN , android.media.tv.TvInputManager#TIME_SHIFT_STATUS_UNSUPPORTED , android.media.tv.TvInputManager#TIME_SHIFT_STATUS_UNAVAILABLE , or android.media.tv.TvInputManager#TIME_SHIFT_STATUS_AVAILABLE |
onTouchEvent
open fun onTouchEvent(event: MotionEvent): Boolean
Implement this method to handle touch screen motion events on the current session.
Parameters | |
---|---|
event |
MotionEvent: The motion event being received. This value cannot be null . |
Return | |
---|---|
Boolean |
If you handled the event, return true . If you want to allow the event to be handled by the next receiver, return false . |
See Also
onTrackInfoList
open fun onTrackInfoList(tracks: MutableList<TvTrackInfo!>): Unit
Receives track list.
Parameters | |
---|---|
tracks |
MutableList<TvTrackInfo!>: This value cannot be null . |
onTrackSelected
open fun onTrackSelected(
type: Int,
trackId: String
): Unit
Called when the corresponding TV input selected to a track. If the track is deselected and no track is currently selected, trackId is an empty string.
Parameters | |
---|---|
type |
Int: Value is android.media.tv.TvTrackInfo#TYPE_AUDIO , android.media.tv.TvTrackInfo#TYPE_VIDEO , or android.media.tv.TvTrackInfo#TYPE_SUBTITLE |
trackId |
String: This value cannot be null . |
onTrackballEvent
open fun onTrackballEvent(event: MotionEvent): Boolean
Implement this method to handle trackball events on the current session.
Parameters | |
---|---|
event |
MotionEvent: The motion event being received. This value cannot be null . |
Return | |
---|---|
Boolean |
If you handled the event, return true . If you want to allow the event to be handled by the next receiver, return false . |
See Also
onTracksChanged
open fun onTracksChanged(tracks: MutableList<TvTrackInfo!>): Unit
Called when the tracks are changed.
Parameters | |
---|---|
tracks |
MutableList<TvTrackInfo!>: This value cannot be null . |
onTuned
open fun onTuned(channelUri: Uri): Unit
Called when the corresponding TV input tuned to a channel.
Parameters | |
---|---|
channelUri |
Uri: The tuned channel URI. This value cannot be null . |
onTvMessage
open fun onTvMessage(
type: Int,
data: Bundle
): Unit
Called when a TV message is received
Parameters | |
---|---|
type |
Int: The type of message received, such as TvInputManager#TV_MESSAGE_TYPE_WATERMARK Value is android.media.tv.TvInputManager#TV_MESSAGE_TYPE_WATERMARK , android.media.tv.TvInputManager#TV_MESSAGE_TYPE_CLOSED_CAPTION , or android.media.tv.TvInputManager#TV_MESSAGE_TYPE_OTHER |
data |
Bundle: The raw data of the message. The bundle keys are: TvInputManager#TV_MESSAGE_KEY_STREAM_ID , TvInputManager#TV_MESSAGE_KEY_GROUP_ID , TvInputManager#TV_MESSAGE_KEY_SUBTYPE , TvInputManager#TV_MESSAGE_KEY_RAW_DATA . See TvInputManager#TV_MESSAGE_KEY_SUBTYPE for more information on how to parse this data. This value cannot be null . |
onTvRecordingInfo
open fun onTvRecordingInfo(recordingInfo: TvRecordingInfo?): Unit
Receives the requested android.media.tv.TvRecordingInfo
.
Parameters | |
---|---|
recordingInfo |
TvRecordingInfo?: The requested recording info. null if no recording found. |
See Also
onTvRecordingInfoList
open fun onTvRecordingInfoList(recordingInfoList: MutableList<TvRecordingInfo!>): Unit
Receives requested recording info list.
Parameters | |
---|---|
recordingInfoList |
MutableList<TvRecordingInfo!>: The list of recording info requested. Returns an empty list if no matching recording info found. This value cannot be null . |
See Also
onVideoAvailable
open fun onVideoAvailable(): Unit
Called when video is available.
onVideoUnavailable
open fun onVideoUnavailable(: Int): Unit
Called when video is unavailable.
removeBroadcastInfo
open fun removeBroadcastInfo(requestId: Int): Unit
Remove broadcast information request from the related TV input.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
requestId |
Int: the ID of the request |
requestAd
open fun requestAd(request: AdRequest): Unit
Sends an advertisement request to be processed by the related TV input.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
request |
AdRequest: The advertisement request This value cannot be null . |
requestAvailableSpeeds
open fun requestAvailableSpeeds(): Unit
Requests available speeds for time shift.
If you override this method you must call through to the superclass implementation.
requestBroadcastInfo
open fun requestBroadcastInfo(request: BroadcastInfoRequest): Unit
Requests broadcast related information from the related TV input.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
request |
BroadcastInfoRequest: the request for broadcast info This value cannot be null . |
requestCurrentChannelLcn
open fun requestCurrentChannelLcn(): Unit
Requests the logic channel number (LCN) of the current channel.
If you override this method you must call through to the superclass implementation.
requestCurrentChannelUri
open fun requestCurrentChannelUri(): Unit
Requests the URI of the current channel.
If you override this method you must call through to the superclass implementation.
requestCurrentTvInputId
open fun requestCurrentTvInputId(): Unit
Requests current TV input ID.
If you override this method you must call through to the superclass implementation.
See Also
requestCurrentVideoBounds
open fun requestCurrentVideoBounds(): Unit
Requests the bounds of the current video.
If you override this method you must call through to the superclass implementation.
requestScheduleRecording
open fun requestScheduleRecording(
requestId: String,
inputId: String,
channelUri: Uri,
programUri: Uri,
params: Bundle
): Unit
Requests scheduling of a recording.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
requestId |
String: The ID of this request which is used to match the corresponding response. The request ID in onRecordingScheduled(java.lang.String,java.lang.String) for this request is the same as the ID sent here. This should be defined by the TvInteractiveAppService and can be any string. Should this API be called with the same requestId twice, both requests should be handled regardless by the TV application. This value cannot be null . |
inputId |
String: The ID of the TV input for the given channel. This value cannot be null . |
channelUri |
Uri: The URI of a channel to be recorded. This value cannot be null . |
programUri |
Uri: The URI of the TV program to be recorded. This value cannot be null . |
params |
Bundle: Domain-specific data for this tune request. Keys must be a scoped name, i.e. prefixed with a package name you own, so that different developers will not create conflicting keys. This value cannot be null . |
requestScheduleRecording
open fun requestScheduleRecording(
requestId: String,
inputId: String,
channelUri: Uri,
startTime: Long,
duration: Long,
repeatDays: Int,
params: Bundle
): Unit
Requests scheduling of a recording.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
requestId |
String: The ID of this request which is used to match the corresponding response. The request ID in onRecordingScheduled(java.lang.String,java.lang.String) for this request is the same as the ID sent here. This should be defined by the TvInteractiveAppService and can be any string. Should this API be called with the same requestId twice, both requests should be handled regardless by the TV application. This value cannot be null . |
inputId |
String: The ID of the TV input for the given channel. This value cannot be null . |
channelUri |
Uri: The URI of a channel to be recorded. This value cannot be null . |
startTime |
Long: The start time of the recording in milliseconds since epoch. |
duration |
Long: The duration of the recording in milliseconds. |
repeatDays |
Int: The repeated days. 0 if not repeated. |
params |
Bundle: Domain-specific data for this tune request. Keys must be a scoped name, i.e. prefixed with a package name you own, so that different developers will not create conflicting keys. This value cannot be null . |
requestSigning
open fun requestSigning(
signingId: String,
algorithm: String,
alias: String,
data: ByteArray
): Unit
Requests signing of the given data.
This is used when the corresponding server of the broadcast-independent interactive app requires signing during handshaking, and the interactive app service doesn't have the built-in private key. The private key is provided by the content providers and pre-built in the related app, such as TV app.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
signingId |
String: the ID to identify the request. When a result is received, this ID can be used to correlate the result with the request. This value cannot be null . |
algorithm |
String: the standard name of the signature algorithm requested, such as MD5withRSA, SHA256withDSA, etc. The name is from standards like FIPS PUB 186-4 and PKCS #1. This value cannot be null . |
alias |
String: the alias of the corresponding java.security.KeyStore . This value cannot be null . |
data |
ByteArray: the original bytes to be signed. This value cannot be null . |
requestStartRecording
open fun requestStartRecording(
requestId: String,
programUri: Uri?
): Unit
Requests starting of recording
This is used to request the active android.media.tv.TvRecordingClient
to call android.media.tv.TvRecordingClient#startRecording(Uri)
with the provided programUri
. A non-null programUri
implies the started recording should be of that specific program, whereas null programUri
does not impose such a requirement and the recording can span across multiple TV programs.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
requestId |
String: The ID of this request which is used to match the corresponding response. The request ID in onRecordingStarted(java.lang.String,java.lang.String) for this request is the same as the ID sent here. This should be defined by the TvInteractiveAppService and can be any string. Should this API be called with the same requestId twice, both requests should be handled regardless by the TV application. This value cannot be null . |
programUri |
Uri?: The URI for the TV program to record, built by TvContract#buildProgramUri(long) . Can be null . |
requestStopRecording
open fun requestStopRecording(recordingId: String): Unit
Requests the recording associated with the recordingId to stop.
This is used to request the associated android.media.tv.TvRecordingClient
to call android.media.tv.TvRecordingClient#stopRecording()
.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
recordingId |
String: The ID of the recording to stop. This is provided by the TV app in TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null . |
requestStreamVolume
open fun requestStreamVolume(): Unit
Requests stream volume.
If you override this method you must call through to the superclass implementation.
requestTimeShiftMode
open fun requestTimeShiftMode(): Unit
Requests time shift mode.
If you override this method you must call through to the superclass implementation.
requestTrackInfoList
open fun requestTrackInfoList(): Unit
Requests the list of TvTrackInfo
.
If you override this method you must call through to the superclass implementation.
requestTvRecordingInfo
open fun requestTvRecordingInfo(recordingId: String): Unit
Gets the recording info for the specified recording
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
recordingId |
String: The ID of the recording to set the info for. This is provided by the TV app in TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null . |
requestTvRecordingInfoList
open fun requestTvRecordingInfoList(type: Int): Unit
Gets a list of TvRecordingInfo
for the specified recording type.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
type |
Int: The type of recording to retrieve. Value is android.media.tv.TvRecordingInfo#RECORDING_SCHEDULED , android.media.tv.TvRecordingInfo#RECORDING_IN_PROGRESS , or android.media.tv.TvRecordingInfo#RECORDING_ALL |
sendPlaybackCommandRequest
open fun sendPlaybackCommandRequest(
cmdType: String,
parameters: Bundle?
): Unit
Sends a specific playback command to be processed by the related TV input.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
cmdType |
String: type of the specific command Value is android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE , android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE_NEXT , android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE_PREV , android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_STOP , android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_SET_STREAM_VOLUME , android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_SELECT_TRACK , or android.media.tv.interactive.TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_FREEZE This value cannot be null . |
parameters |
Bundle?: parameters of the specific command This value may be null . |
sendTimeShiftCommandRequest
open fun sendTimeShiftCommandRequest(
cmdType: String,
parameters: Bundle?
): Unit
Sends a specific time shift command to be processed by the related TV input.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
cmdType |
String: type of the specific command Value is android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_PLAY , android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_PAUSE , android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_RESUME , android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SEEK_TO , android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SET_PLAYBACK_PARAMS , or android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SET_MODE This value cannot be null . |
parameters |
Bundle?: parameters of the specific command This value may be null . |
setMediaViewEnabled
open fun setMediaViewEnabled(enable: Boolean): Unit
Enables or disables the media view.
By default, the media view is disabled. Must be called explicitly after the session is created to enable the media view.
The TV Interactive App service can disable its media view when needed.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
enable |
Boolean: true if you want to enable the media view. false otherwise. |
setTvRecordingInfo
open fun setTvRecordingInfo(
recordingId: String,
recordingInfo: TvRecordingInfo
): Unit
Sets the recording info for the specified recording
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
recordingId |
String: The ID of the recording to set the info for. This is provided by the TV app in TvInteractiveAppView#notifyRecordingStarted(String, String) This value cannot be null . |
recordingInfo |
TvRecordingInfo: The TvRecordingInfo to set to the recording. This value cannot be null . |
setVideoBounds
open fun setVideoBounds(rect: Rect): Unit
Sets broadcast video bounds.
If you override this method you must call through to the superclass implementation.
Parameters | |
---|---|
rect |
Rect: This value cannot be null . |