Added in API level 33

TvInteractiveAppView


open class TvInteractiveAppView : ViewGroup
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.media.tv.interactive.TvInteractiveAppView

Displays contents of interactive TV applications.

Summary

Nested classes
abstract

Interface definition for a callback to be invoked when the unhandled input event is received.

abstract

Callback used to receive various status updates on the TvInteractiveAppView.

Inherited XML attributes
Constants
static String

Used to share the KeyStore alias with TvInteractiveAppService.

static String

Used to share client java.security.cert.Certificate with TvInteractiveAppService.

static String

Additional HTTP headers to be used by TvInteractiveAppService to load the broadcast-independent interactive application.

static String

HTTP user agent to be used by TvInteractiveAppService for broadcast-independent interactive application.

static String

Used to share the java.security.PrivateKey with TvInteractiveAppService.

static String

The name of the method where the error happened, if applicable.

Inherited constants
Public constructors

TvInteractiveAppView(context: Context, attrs: AttributeSet?, defStyleAttr: Int)

Public methods
open Unit

Clears the callback.

open Unit

Clears the OnUnhandledInputEventListener.

open Unit
createBiInteractiveApp(biIAppUri: Uri, params: Bundle?)

Creates broadcast-independent(BI) interactive application.

open Unit

Destroys broadcast-independent(BI) interactive application.

open Boolean

Dispatch a key event to the next view on the focus path.

open Boolean

Dispatches an unhandled input event to the next receiver.

open TvInteractiveAppView.OnUnhandledInputEventListener?

Gets the OnUnhandledInputEventListener.

open Unit
notifyError(errMsg: String, params: Bundle)

Notifies the corresponding TvInteractiveAppService when there is an error.

open Unit
notifyRecordingScheduled(recordingId: String, requestId: String?)

This is called to notify the corresponding interactive app service when the recording has been scheduled.

open Unit
notifyRecordingStarted(recordingId: String, requestId: String?)

Alerts the related TV interactive app service that a recording has been started.

open Unit

Alerts the TV interactive app that a recording has been stopped.

open Unit

Notifies the corresponding TvInteractiveAppService when time shift current position is changed.

open Unit

Notifies the corresponding TvInteractiveAppService when a time shift android.media.PlaybackParams is set or changed.

open Unit

Notifies the corresponding TvInteractiveAppService when time shift start position is changed.

open Unit

Notifies the corresponding TvInteractiveAppService when time shift status is changed.

open Unit
notifyTvMessage(type: Int, data: Bundle)

This is called to notify the corresponding interactive app service when a new TV message is received.

open Unit

Alerts the TV Interactive app that the video freeze state has been updated.

open Unit

open Unit

open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

open Boolean

Called when an unhandled input event also has not been handled by the user provided callback.

open Unit
onVisibilityChanged(changedView: View, visibility: Int)

Called when the visibility of the view or an ancestor of the view has changed.

open Unit
prepareInteractiveApp(iAppServiceId: String, type: Int)

Prepares the interactive application runtime environment of corresponding TvInteractiveAppService.

open Unit

Resets this TvInteractiveAppView to release its resources.

open Unit

Resets the interactive application.

open Unit

Sends the available supported playback speeds to the TV interactive app bound to this view.

open Unit
sendCertificate(host: String, port: Int, cert: SslCertificate)

Sends the requested SSL certificate to the TV Interactive App

open Unit

Sends current channel logical channel number (LCN) to related TV interactive app.

open Unit
sendCurrentChannelUri(channelUri: Uri?)

Sends current channel URI to related TV interactive app.

open Unit

Sends current TV input ID to related TV interactive app.

open Unit

Sends current video bounds to related TV interactive app.

open Unit

Sends the currently selected track info to the TV Interactive App in response to a TvInteractiveAppCallback.onRequestSelectedTrackInfo(String) request.

open Unit
sendSigningResult(signingId: String, result: ByteArray)

Sends signing result to related TV interactive app.

open Unit

Sends stream volume to related TV interactive app.

open Unit

Sends the current time shift mode to the TV interactive app bound to this view

open Unit

Sends track info list to related TV interactive app.

open Unit

Sends the requested android.media.tv.TvRecordingInfo.

open Unit

Sends the requested android.media.tv.TvRecordingInfo.

open Unit

Sets the callback to be invoked when an event is dispatched to this TvInteractiveAppView.

open Unit

Sets a listener to be invoked when an input event is not handled by the TV Interactive App.

open Unit

To toggle Digital Teletext Application if there is one in AIT app list.

open Int
setTvView(tvView: TvView?)

Sets the TvInteractiveAppView to receive events from TIS.

open Unit
setZOrderMediaOverlay(isMediaOverlay: Boolean)

Controls whether the TvInteractiveAppView's surface is placed on top of other regular surface views in the window (but still behind the window itself).

open Unit

Controls whether the TvInterActiveAppView's surface is placed on top of its window.

open Unit

Starts the interactive application.

open Unit

Stops the interactive application.

Inherited functions
Inherited properties

Constants

BI_INTERACTIVE_APP_KEY_ALIAS

Added in API level 33
static val BI_INTERACTIVE_APP_KEY_ALIAS: String

Used to share the KeyStore alias with TvInteractiveAppService.

Value: "alias"

BI_INTERACTIVE_APP_KEY_CERTIFICATE

Added in API level 33
static val BI_INTERACTIVE_APP_KEY_CERTIFICATE: String

Used to share client java.security.cert.Certificate with TvInteractiveAppService.

Value: "certificate"

BI_INTERACTIVE_APP_KEY_HTTP_ADDITIONAL_HEADERS

Added in API level 33
static val BI_INTERACTIVE_APP_KEY_HTTP_ADDITIONAL_HEADERS: String

Additional HTTP headers to be used by TvInteractiveAppService to load the broadcast-independent interactive application.

Value: "http_additional_headers"

BI_INTERACTIVE_APP_KEY_HTTP_USER_AGENT

Added in API level 33
static val BI_INTERACTIVE_APP_KEY_HTTP_USER_AGENT: String

HTTP user agent to be used by TvInteractiveAppService for broadcast-independent interactive application.

Value: "http_user_agent"

BI_INTERACTIVE_APP_KEY_PRIVATE_KEY

Added in API level 33
static val BI_INTERACTIVE_APP_KEY_PRIVATE_KEY: String

Used to share the java.security.PrivateKey with TvInteractiveAppService.

The private key is optional. It is used to encrypt data when necessary.

Value: "private_key"

ERROR_KEY_METHOD_NAME

Added in API level 33
static val ERROR_KEY_METHOD_NAME: String

The name of the method where the error happened, if applicable. For example, if there is an error during signing, the request name is "onRequestSigning".

Value: "method_name"

Public constructors

TvInteractiveAppView

Added in API level 33
TvInteractiveAppView(context: Context)
Parameters
context Context: This value cannot be null.

TvInteractiveAppView

Added in API level 33
TvInteractiveAppView(
    context: Context,
    attrs: AttributeSet?)
Parameters
context Context: This value cannot be null.
attrs AttributeSet?: This value may be null.

TvInteractiveAppView

Added in API level 33
TvInteractiveAppView(
    context: Context,
    attrs: AttributeSet?,
    defStyleAttr: Int)
Parameters
context Context: This value cannot be null.
attrs AttributeSet?: This value may be null.

Public methods

clearCallback

Added in API level 33
open fun clearCallback(): Unit

Clears the callback.

clearOnUnhandledInputEventListener

Added in API level 33
open fun clearOnUnhandledInputEventListener(): Unit

Clears the OnUnhandledInputEventListener.

createBiInteractiveApp

Added in API level 33
open fun createBiInteractiveApp(
    biIAppUri: Uri,
    params: Bundle?
): Unit

Creates broadcast-independent(BI) interactive application.

TvInteractiveAppCallback.onBiInteractiveAppCreated(String, Uri, String) will be called for the result.

Parameters
biIAppUri Uri: URI associated this BI interactive app. This value cannot be null.
params Bundle?: optional parameters for broadcast-independent interactive application, such as BI_INTERACTIVE_APP_KEY_CERTIFICATE. This value may be null.

destroyBiInteractiveApp

Added in API level 33
open fun destroyBiInteractiveApp(biIAppId: String): Unit

Destroys broadcast-independent(BI) interactive application.

Parameters
biIAppId String: the BI interactive app ID from createBiInteractiveApp(android.net.Uri,android.os.Bundle) This value cannot be null.

dispatchKeyEvent

Added in API level 33
open fun dispatchKeyEvent(event: KeyEvent): Boolean

Dispatch a key event to the next view on the focus path. This path runs from the top of the view tree down to the currently focused view. If this view has focus, it will dispatch to itself. Otherwise it will dispatch the next node down the focus path. This method also fires any key listeners.

Parameters
event KeyEvent: This value cannot be null.
Return
Boolean True if the event was handled, false otherwise.

dispatchUnhandledInputEvent

Added in API level 33
open fun dispatchUnhandledInputEvent(event: InputEvent): Boolean

Dispatches an unhandled input event to the next receiver. It gives the host application a chance to dispatch the unhandled input events.

Parameters
event InputEvent: The input event. This value cannot be null.
Return
Boolean true if the event was handled by the view, false otherwise.

getOnUnhandledInputEventListener

Added in API level 33
open fun getOnUnhandledInputEventListener(): TvInteractiveAppView.OnUnhandledInputEventListener?

Gets the OnUnhandledInputEventListener.

Returns null if the listener is not set or is cleared.

notifyError

Added in API level 33
open fun notifyError(
    errMsg: String,
    params: Bundle
): Unit

Notifies the corresponding TvInteractiveAppService when there is 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.

notifyRecordingScheduled

Added in API level 34
open fun notifyRecordingScheduled(
    recordingId: String,
    requestId: String?
): Unit

This is called to notify the corresponding interactive app service 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 TvInteractiveAppService.Session.requestStopRecording(String). This value cannot be null.
requestId String?: The ID of the request when android.media.tv.interactive.TvInteractiveAppService.Session#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.

notifyRecordingStarted

Added in API level 34
open fun notifyRecordingStarted(
    recordingId: String,
    requestId: String?
): Unit

Alerts the related TV interactive app service that a recording has been started.

Parameters
recordingId String: The ID of the recording started. This ID is created and maintained by the TV app and is used to identify the recording in the future. This value cannot be null.
requestId String?: The ID of the request when TvInteractiveAppService.Session.requestStartRecording(String, Uri) 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.

notifyRecordingStopped

Added in API level 34
open fun notifyRecordingStopped(recordingId: String): Unit

Alerts the TV interactive app that a recording has been stopped.

Parameters
recordingId String: The ID of the recording stopped. This ID is created and maintained by the TV app when a recording is started. This value cannot be null.

notifyTimeShiftCurrentPositionChanged

Added in API level 34
open fun notifyTimeShiftCurrentPositionChanged(
    inputId: String,
    timeMs: Long
): Unit

Notifies the corresponding TvInteractiveAppService 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.

notifyTimeShiftPlaybackParams

Added in API level 34
open fun notifyTimeShiftPlaybackParams(params: PlaybackParams): Unit

Notifies the corresponding TvInteractiveAppService when a 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.

notifyTimeShiftStartPositionChanged

Added in API level 34
open fun notifyTimeShiftStartPositionChanged(
    inputId: String,
    timeMs: Long
): Unit

Notifies the corresponding TvInteractiveAppService 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.

notifyTimeShiftStatusChanged

Added in API level 34
open fun notifyTimeShiftStatusChanged(
    inputId: String,
    status: Int
): Unit

Notifies the corresponding TvInteractiveAppService 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. Value is 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

notifyTvMessage

Added in API level 34
open fun notifyTvMessage(
    type: Int,
    data: Bundle
): Unit

This is called to notify the corresponding interactive app service when a new TV message is received.

Parameters
type Int: The type of message received, such as TvInputManager.TV_MESSAGE_TYPE_WATERMARK This value cannot be null. 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.

notifyVideoFreezeUpdated

open fun notifyVideoFreezeUpdated(isFrozen: Boolean): Unit

Alerts the TV Interactive app that the video freeze state has been updated. If true, the video is frozen on the last frame while audio playback continues.

Parameters
isFrozen Boolean: Whether the video is frozen.

onAttachedToWindow

Added in API level 33
open fun onAttachedToWindow(): Unit

onDetachedFromWindow

Added in API level 33
open fun onDetachedFromWindow(): Unit

onLayout

Added in API level 33
open fun onLayout(
    changed: Boolean,
    left: Int,
    top: Int,
    right: Int,
    bottom: Int
): Unit
Parameters
changed Boolean: This is a new size or position for this view
left Int: Left position, relative to parent
top Int: Top position, relative to parent
right Int: Right position, relative to parent
bottom Int: Bottom position, relative to parent

onMeasure

Added in API level 33
open fun onMeasure(
    widthMeasureSpec: Int,
    heightMeasureSpec: Int
): Unit
Parameters
widthMeasureSpec Int: horizontal space requirements as imposed by the parent. The requirements are encoded with android.view.View.MeasureSpec.
heightMeasureSpec Int: vertical space requirements as imposed by the parent. The requirements are encoded with android.view.View.MeasureSpec.

onUnhandledInputEvent

Added in API level 33
open fun onUnhandledInputEvent(event: InputEvent): Boolean

Called when an unhandled input event also has not been handled by the user provided callback. This is the last chance to handle the unhandled input event in the TvInteractiveAppView.

Parameters
event InputEvent: The input event. 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.

onVisibilityChanged

Added in API level 33
open fun onVisibilityChanged(
    changedView: View,
    visibility: Int
): Unit

Called when the visibility of the view or an ancestor of the view has changed.

Parameters
changedView View: This value cannot be null.
visibility Int: The new visibility, one of VISIBLE, INVISIBLE or GONE. Value is android.view.View#VISIBLE, android.view.View#INVISIBLE, or android.view.View#GONE

reset

Added in API level 33
open fun reset(): Unit

Resets this TvInteractiveAppView to release its resources.

It can be reused by call prepareInteractiveApp(java.lang.String,int).

resetInteractiveApp

Added in API level 33
open fun resetInteractiveApp(): Unit

Resets the interactive application.

This releases the resources of the corresponding TvInteractiveAppService.Session.

sendAvailableSpeeds

Added in API level 34
open fun sendAvailableSpeeds(speeds: FloatArray): Unit

Sends the available supported playback speeds to the TV interactive app bound to this view.

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.

sendCertificate

open fun sendCertificate(
    host: String,
    port: Int,
    cert: SslCertificate
): Unit

Sends the requested SSL certificate to the TV Interactive App

Parameters
host String: the host name of the SSL authentication server. This value cannot be null.
port Int: the port of the SSL authentication server. E.g., 443
cert SslCertificate: the SSL certificate requested This value cannot be null.

sendCurrentChannelLcn

Added in API level 33
open fun sendCurrentChannelLcn(lcn: Int): Unit

Sends current channel logical channel number (LCN) to related TV interactive app.

sendCurrentChannelUri

Added in API level 33
open fun sendCurrentChannelUri(channelUri: Uri?): Unit

Sends current channel URI to related TV interactive app.

Parameters
channelUri Uri?: The current channel URI; null if there is no currently tuned channel.

sendCurrentTvInputId

Added in API level 33
open fun sendCurrentTvInputId(inputId: String?): Unit

Sends current TV input ID to related TV interactive app.

Parameters
inputId String?: The current TV input ID whose channel is tuned. null if no channel is tuned.

sendCurrentVideoBounds

Added in API level 34
open fun sendCurrentVideoBounds(bounds: Rect): Unit

Sends current video bounds to related TV interactive app.

Parameters
bounds Rect: the rectangle area for rendering the current video. This value cannot be null.

sendSelectedTrackInfo

open fun sendSelectedTrackInfo(tracks: MutableList<TvTrackInfo!>?): Unit

Sends the currently selected track info to the TV Interactive App in response to a TvInteractiveAppCallback.onRequestSelectedTrackInfo(String) request.

Parameters
tracks MutableList<TvTrackInfo!>?: list of TvTrackInfo of the currently selected track(s) This value may be null.

sendSigningResult

Added in API level 33
open fun sendSigningResult(
    signingId: String,
    result: ByteArray
): Unit

Sends signing result to related TV interactive app.

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.

Parameters
signingId String: the ID to identify the request. It's the same as the corresponding ID in TvInteractiveAppService.Session.requestSigning(String, String, String, byte[]) This value cannot be null.
result ByteArray: the signed result. This value cannot be null.

sendStreamVolume

Added in API level 33
open fun sendStreamVolume(volume: Float): Unit

Sends stream volume to related TV interactive app.

Parameters
volume Float: a volume value between 0.0f and 1.0f, inclusive.

sendTimeShiftMode

Added in API level 34
open fun sendTimeShiftMode(mode: Int): Unit

Sends the current time shift mode to the TV interactive app bound to this view

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

sendTrackInfoList

Added in API level 33
open fun sendTrackInfoList(tracks: MutableList<TvTrackInfo!>?): Unit

Sends track info list to related TV interactive app.

Parameters
tracks MutableList<TvTrackInfo!>?: This value may be null.

sendTvRecordingInfo

Added in API level 34
open fun sendTvRecordingInfo(recordingInfo: TvRecordingInfo?): Unit

Sends the requested android.media.tv.TvRecordingInfo.

Parameters
recordingInfo TvRecordingInfo?: The recording info requested. null if no recording found.

sendTvRecordingInfoList

Added in API level 34
open fun sendTvRecordingInfoList(recordingInfoList: MutableList<TvRecordingInfo!>): Unit

Sends the requested android.media.tv.TvRecordingInfo.

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.

setCallback

Added in API level 33
open fun setCallback(
    executor: Executor,
    callback: TvInteractiveAppView.TvInteractiveAppCallback
): Unit

Sets the callback to be invoked when an event is dispatched to this TvInteractiveAppView.

Parameters
callback TvInteractiveAppView.TvInteractiveAppCallback: the callback to receive events. MUST NOT be null.
executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

See Also

setOnUnhandledInputEventListener

Added in API level 33
open fun setOnUnhandledInputEventListener(
    executor: Executor,
    listener: TvInteractiveAppView.OnUnhandledInputEventListener
): Unit

Sets a listener to be invoked when an input event is not handled by the TV Interactive App.

Parameters
listener TvInteractiveAppView.OnUnhandledInputEventListener: The callback to be invoked when the unhandled input event is received. This value cannot be null.
executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

setTeletextAppEnabled

Added in API level 33
open fun setTeletextAppEnabled(enable: Boolean): Unit

To toggle Digital Teletext Application if there is one in AIT app list.

A Teletext Application is a broadcast-related application to display text and basic graphics.

Parameters
enable Boolean: true to enable Teletext app; false to disable it.

setTvView

Added in API level 33
open fun setTvView(tvView: TvView?): Int

Sets the TvInteractiveAppView to receive events from TIS. This method links the session of TvInteractiveAppManager to TvInputManager session, so the TIAS can get the TIS events.

Parameters
tvView TvView?: the TvView to be linked to this TvInteractiveAppView via linking of Sessions. This value may be null.
Return
Int The result of the operation.

setZOrderMediaOverlay

open fun setZOrderMediaOverlay(isMediaOverlay: Boolean): Unit

Controls whether the TvInteractiveAppView's surface is placed on top of other regular surface views in the window (but still behind the window itself).

Calling this overrides any previous call to setZOrderOnTop.

Parameters
isMediaOverlay Boolean: true to be on top of another regular surface, false otherwise.

setZOrderOnTop

open fun setZOrderOnTop(onTop: Boolean): Unit

Controls whether the TvInterActiveAppView's surface is placed on top of its window.

Calling this overrides any previous call to setZOrderMediaOverlay.

Parameters
onTop Boolean: true to be on top of its window, false otherwise.

startInteractiveApp

Added in API level 33
open fun startInteractiveApp(): Unit

Starts the interactive application.

stopInteractiveApp

Added in API level 33
open fun stopInteractiveApp(): Unit

Stops the interactive application.