# TvInteractiveAppService.Session

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

Session
=======

*** ** * ** ***

Kotlin \|[Java](/reference/android/media/tv/interactive/TvInteractiveAppService.Session "View this page in Java")  

```
abstract class Session : KeyEvent.Callback
```

|---|-------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [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](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView) instance and handles corresponding communications. It also handles the communications with [android.media.tv.TvInputService.Session](../TvInputService.Session.html#) if connected.

Summary
-------

|                                                       Public constructors                                                        ||
|-------------------------------------------------------------------------------------------------------------------------------|---|
| [Session](#Session(android.content.Context))`(`context:` `[Context](../../../content/Context.html#)`)` Creates a new Session. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                          Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                          ||
|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)     | [isMediaViewEnabled](#isMediaViewEnabled())`()` Returns `true` if media view is enabled, `false` otherwise.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [layoutSurface](#layoutSurface(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`left:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `top:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `right:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `bottom:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Assigns a size and position to the surface passed in [onSetSurface](#onSetSurface(android.view.Surface)).                                                                                                                                                                                                                                         |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [notifyAdBufferReady](#notifyAdBufferReady(android.media.tv.AdBuffer))`(`buffer:` `[AdBuffer](../AdBuffer.html#)`)` Notifies when the advertisement buffer is filled and ready to be read.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                | [notifyBiInteractiveAppCreated](#notifyBiInteractiveAppCreated(android.net.Uri,%20kotlin.String))`(`biIAppUri:` `[Uri](../../../net/Uri.html#)`, `biIAppId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` Notifies the broadcast-independent(BI) interactive application has been created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [notifySessionStateChanged](#notifySessionStateChanged(kotlin.Int,%20kotlin.Int))`(`state:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `err:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Notifies when the session state is changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                | [notifyTeletextAppStateChanged](#notifyTeletextAppStateChanged(kotlin.Int))`(`state:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Notifies when the digital teletext app state is changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onAdBufferConsumed](#onAdBufferConsumed(android.media.tv.AdBuffer))`(`buffer:` `[AdBuffer](../AdBuffer.html#)`)` Called when an advertisement buffer is consumed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onAdResponse](#onAdResponse(android.media.tv.AdResponse))`(`response:` `[AdResponse](../AdResponse.html#)`)` Called when an advertisement response is received.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onAvailableSpeeds](#onAvailableSpeeds(kotlin.FloatArray))`(`speeds:` `[FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)`)` Receives available playback speeds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onBroadcastInfoResponse](#onBroadcastInfoResponse(android.media.tv.BroadcastInfoResponse))`(`response:` `[BroadcastInfoResponse](../BroadcastInfoResponse.html#)`)` Called when a broadcast info response is received.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onCertificate](#onCertificate(kotlin.String,%20kotlin.Int,%20android.net.http.SslCertificate))`(`host:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `port:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `cert:` `[SslCertificate](../../../net/http/SslCertificate.html#)`)` Receives the requested Certificate                                                                                                                                                                                                                                                                                                                                                                                                          |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onContentAllowed](#onContentAllowed())`()` Called when content is allowed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onContentBlocked](#onContentBlocked(android.media.tv.TvContentRating))`(`rating:` `[TvContentRating](../TvContentRating.html#)`)` Called when content is blocked.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onCreateBiInteractiveAppRequest](#onCreateBiInteractiveAppRequest(android.net.Uri,%20android.os.Bundle))`(`biIAppUri:` `[Uri](../../../net/Uri.html#)`, `params:` `[Bundle](../../../os/Bundle.html#)?`)` Creates broadcast-independent(BI) interactive application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| open [View](../../../view/View.html#)?                                                      | [onCreateMediaView](#onCreateMediaView())`()` Called when the application requests to create an media view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onCurrentChannelLcn](#onCurrentChannelLcn(kotlin.Int))`(`lcn:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Receives logical channel number (LCN) of current channel.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onCurrentChannelUri](#onCurrentChannelUri(android.net.Uri))`(`channelUri:` `[Uri](../../../net/Uri.html#)?`)` Receives current channel URI.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onCurrentTvInputId](#onCurrentTvInputId(kotlin.String))`(`inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` Receives current TV input ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onCurrentVideoBounds](#onCurrentVideoBounds(android.graphics.Rect))`(`bounds:` `[Rect](../../../graphics/Rect.html#)`)` Receives current video bounds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onDestroyBiInteractiveAppRequest](#onDestroyBiInteractiveAppRequest(kotlin.String))`(`biIAppId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Destroys broadcast-independent(BI) interactive application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onError](#onError(kotlin.String,%20android.os.Bundle))`(`errMsg:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `params:` `[Bundle](../../../os/Bundle.html#)`)` Called when the application sends information of an error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)     | [onGenericMotionEvent](#onGenericMotionEvent(android.view.MotionEvent))`(`event:` `[MotionEvent](../../../view/MotionEvent.html#)`)` Implement this method to handle generic motion events on the current session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)     | [onKeyDown](#onKeyDown(kotlin.Int,%20android.view.KeyEvent))`(`keyCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `event:` `[KeyEvent](../../../view/KeyEvent.html#)`)` Called when a key down event has occurred.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)     | [onKeyLongPress](#onKeyLongPress(kotlin.Int,%20android.view.KeyEvent))`(`keyCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `event:` `[KeyEvent](../../../view/KeyEvent.html#)`)` Called when a long press has occurred.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)     | [onKeyMultiple](#onKeyMultiple(kotlin.Int,%20kotlin.Int,%20android.view.KeyEvent))`(`keyCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `count:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `event:` `[KeyEvent](../../../view/KeyEvent.html#)`)` 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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)     | [onKeyUp](#onKeyUp(kotlin.Int,%20android.view.KeyEvent))`(`keyCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `event:` `[KeyEvent](../../../view/KeyEvent.html#)`)` Called when a key up event has occurred.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onMediaViewSizeChanged](#onMediaViewSizeChanged(kotlin.Int,%20kotlin.Int))`(`width:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `height:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called when the size of the media view is changed by the application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onRecordingConnectionFailed](#onRecordingConnectionFailed(kotlin.String,%20kotlin.String))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` This is called when an error occurred while establishing a connection to the recording session for the corresponding TV input.                                                                                                                                                                                                                                                                                                                                                                      |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onRecordingDisconnected](#onRecordingDisconnected(kotlin.String,%20kotlin.String))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` This is called when the connection to the current recording session is lost.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onRecordingError](#onRecordingError(kotlin.String,%20kotlin.Int))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `err:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` This is called when an issue has occurred.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onRecordingScheduled](#onRecordingScheduled(kotlin.String,%20kotlin.String))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `requestId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` This is called when the recording has been scheduled.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onRecordingStarted](#onRecordingStarted(kotlin.String,%20kotlin.String))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `requestId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` This is called when a recording has been started.                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onRecordingStopped](#onRecordingStopped(kotlin.String))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` This is called when the recording has been stopped.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onRecordingTuned](#onRecordingTuned(kotlin.String,%20android.net.Uri))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `channelUri:` `[Uri](../../../net/Uri.html#)`)` This is called when the recording session has been tuned to the given channel and is ready to start recording.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [onRelease](#onRelease())`()` Releases TvInteractiveAppService session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onResetInteractiveApp](#onResetInteractiveApp())`()` Resets TvInteractiveAppService session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onSelectedTrackInfo](#onSelectedTrackInfo(kotlin.collections.MutableList))`(`tracks:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[TvTrackInfo](../TvTrackInfo.html#)!>`)` Called when the TV App sends the selected track info as a response to [requestSelectedTrackInfo()](#requestSelectedTrackInfo()).                                                                                                                                                                                                                                                                                                                                                                                                                           |
| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onSetSurface](#onSetSurface(android.view.Surface))`(`surface:` `[Surface](../../../view/Surface.html#)?`)` Called when the application sets the surface.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onSetTeletextAppEnabled](#onSetTeletextAppEnabled(kotlin.Boolean))`(`enable:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` To toggle Digital Teletext Application if there is one in AIT app list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onSignalStrength](#onSignalStrength(kotlin.Int))`(`strength:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called when signal strength is changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onSigningResult](#onSigningResult(kotlin.String,%20kotlin.ByteArray))`(`signingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `result:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Receives signing result.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onStartInteractiveApp](#onStartInteractiveApp())`()` Starts TvInteractiveAppService session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onStopInteractiveApp](#onStopInteractiveApp())`()` Stops TvInteractiveAppService session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onStreamVolume](#onStreamVolume(kotlin.Float))`(`volume:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Receives current stream volume.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onSurfaceChanged](#onSurfaceChanged(kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`format:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `width:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `height:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called after any structural changes (format or size) have been made to the surface passed in [onSetSurface](#onSetSurface(android.view.Surface)).                                                                                                                                                                                                                                                                                            |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTimeShiftCurrentPositionChanged](#onTimeShiftCurrentPositionChanged(kotlin.String,%20kotlin.Long))`(`inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `timeMs:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Called when time shift current position is changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTimeShiftMode](#onTimeShiftMode(kotlin.Int))`(`mode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Receives current time shift mode.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTimeShiftPlaybackParams](#onTimeShiftPlaybackParams(android.media.PlaybackParams))`(`params:` `[PlaybackParams](../../PlaybackParams.html#)`)` Called when the time shift [android.media.PlaybackParams](../../PlaybackParams.html#) is set or changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTimeShiftStartPositionChanged](#onTimeShiftStartPositionChanged(kotlin.String,%20kotlin.Long))`(`inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `timeMs:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Called when time shift start position is changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTimeShiftStatusChanged](#onTimeShiftStatusChanged(kotlin.String,%20kotlin.Int))`(`inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `status:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called when time shift status is changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)     | [onTouchEvent](#onTouchEvent(android.view.MotionEvent))`(`event:` `[MotionEvent](../../../view/MotionEvent.html#)`)` Implement this method to handle touch screen motion events on the current session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTrackInfoList](#onTrackInfoList(kotlin.collections.MutableList))`(`tracks:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[TvTrackInfo](../TvTrackInfo.html#)!>`)` Receives track list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTrackSelected](#onTrackSelected(kotlin.Int,%20kotlin.String))`(`type:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `trackId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Called when the corresponding TV input selected to a track.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)     | [onTrackballEvent](#onTrackballEvent(android.view.MotionEvent))`(`event:` `[MotionEvent](../../../view/MotionEvent.html#)`)` Implement this method to handle trackball events on the current session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTracksChanged](#onTracksChanged(kotlin.collections.MutableList))`(`tracks:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[TvTrackInfo](../TvTrackInfo.html#)!>`)` Called when the tracks are changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTuned](#onTuned(android.net.Uri))`(`channelUri:` `[Uri](../../../net/Uri.html#)`)` Called when the corresponding TV input tuned to a channel.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTvMessage](#onTvMessage(kotlin.Int,%20android.os.Bundle))`(`type:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `data:` `[Bundle](../../../os/Bundle.html#)`)` Called when a TV message is received                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTvRecordingInfo](#onTvRecordingInfo(android.media.tv.TvRecordingInfo))`(`recordingInfo:` `[TvRecordingInfo](../TvRecordingInfo.html#)?`)` Receives the requested [android.media.tv.TvRecordingInfo](../TvRecordingInfo.html#).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onTvRecordingInfoList](#onTvRecordingInfoList(kotlin.collections.MutableList))`(`recordingInfoList:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[TvRecordingInfo](../TvRecordingInfo.html#)!>`)` Receives requested recording info list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onVideoAvailable](#onVideoAvailable())`()` Called when video is available.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onVideoFreezeUpdated](#onVideoFreezeUpdated(kotlin.Boolean))`(`isFrozen:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Called when video becomes frozen or unfrozen.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [onVideoUnavailable](#onVideoUnavailable(kotlin.Int))`(`reason:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called when video is unavailable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [removeBroadcastInfo](#removeBroadcastInfo(kotlin.Int))`(`requestId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Remove broadcast information request from the related TV input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestAd](#requestAd(android.media.tv.AdRequest))`(`request:` `[AdRequest](../AdRequest.html#)`)` Sends an advertisement request to be processed by the related TV input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestAvailableSpeeds](#requestAvailableSpeeds())`()` Requests available speeds for time shift.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestBroadcastInfo](#requestBroadcastInfo(android.media.tv.BroadcastInfoRequest))`(`request:` `[BroadcastInfoRequest](../BroadcastInfoRequest.html#)`)` Requests broadcast related information from the related TV input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestCertificate](#requestCertificate(kotlin.String,%20kotlin.Int))`(`host:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `port:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Requests a SSL certificate for client validation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestCurrentChannelLcn](#requestCurrentChannelLcn())`()` Requests the logic channel number (LCN) of the current channel.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestCurrentChannelUri](#requestCurrentChannelUri())`()` Requests the URI of the current channel.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestCurrentTvInputId](#requestCurrentTvInputId())`()` Requests current TV input ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestCurrentVideoBounds](#requestCurrentVideoBounds())`()` Requests the bounds of the current video.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestScheduleRecording](#requestScheduleRecording(kotlin.String,%20kotlin.String,%20android.net.Uri,%20android.net.Uri,%20android.os.Bundle))`(`requestId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `channelUri:` `[Uri](../../../net/Uri.html#)`, `programUri:` `[Uri](../../../net/Uri.html#)`, `params:` `[Bundle](../../../os/Bundle.html#)`)` Requests scheduling of a recording.                                                                                                                                                                                                                                                                |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestScheduleRecording](#requestScheduleRecording(kotlin.String,%20kotlin.String,%20android.net.Uri,%20kotlin.Long,%20kotlin.Long,%20kotlin.Int,%20android.os.Bundle))`(`requestId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `inputId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `channelUri:` `[Uri](../../../net/Uri.html#)`, `startTime:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `duration:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `repeatDays:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `params:` `[Bundle](../../../os/Bundle.html#)`)` Requests scheduling of a recording. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestSelectedTrackInfo](#requestSelectedTrackInfo())`()` Requests a list of the currently selected [TvTrackInfo](../TvTrackInfo.html#) from the TV App.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestSigning](#requestSigning(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.ByteArray))`(`signingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `algorithm:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `alias:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Requests signing of the given data.                                                                                                                                                                                                                                                      |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestSigning](#requestSigning(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.Int,%20kotlin.ByteArray))`(`signingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `algorithm:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `host:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `port:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Requests signing of the given data.                                                                                                                                                   |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestStartRecording](#requestStartRecording(kotlin.String,%20android.net.Uri))`(`requestId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `programUri:` `[Uri](../../../net/Uri.html#)?`)` Requests starting of recording                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestStopRecording](#requestStopRecording(kotlin.String))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Requests the recording associated with the recordingId to stop.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestStreamVolume](#requestStreamVolume())`()` Requests stream volume.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestTimeShiftMode](#requestTimeShiftMode())`()` Requests time shift mode.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestTrackInfoList](#requestTrackInfoList())`()` Requests the list of [TvTrackInfo](../TvTrackInfo.html#).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestTvRecordingInfo](#requestTvRecordingInfo(kotlin.String))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Gets the recording info for the specified recording If you override this method you *must* call through to the superclass implementation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [requestTvRecordingInfoList](#requestTvRecordingInfoList(kotlin.Int))`(`type:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Gets a list of [TvRecordingInfo](../TvRecordingInfo.html#) for the specified recording type.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [sendPlaybackCommandRequest](#sendPlaybackCommandRequest(kotlin.String,%20android.os.Bundle))`(`cmdType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `parameters:` `[Bundle](../../../os/Bundle.html#)?`)` Sends a specific playback command to be processed by the related TV input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [sendTimeShiftCommandRequest](#sendTimeShiftCommandRequest(kotlin.String,%20android.os.Bundle))`(`cmdType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `parameters:` `[Bundle](../../../os/Bundle.html#)?`)` Sends a specific time shift command to be processed by the related TV input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [setMediaViewEnabled](#setMediaViewEnabled(kotlin.Boolean))`(`enable:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Enables or disables the media view.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [setTvRecordingInfo](#setTvRecordingInfo(kotlin.String,%20android.media.tv.TvRecordingInfo))`(`recordingId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `recordingInfo:` `[TvRecordingInfo](../TvRecordingInfo.html#)`)` Sets the recording info for the specified recording If you override this method you *must* call through to the superclass implementation.                                                                                                                                                                                                                                                                                                                                                                                         |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [setVideoBounds](#setVideoBounds(android.graphics.Rect))`(`rect:` `[Rect](../../../graphics/Rect.html#)`)` Sets broadcast video bounds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

Public constructors
-------------------

### Session

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Session(context: Context)
```

Creates a new Session.

|                                                    Parameters                                                     ||
|-----------|--------------------------------------------------------------------------------------------------------|
| `context` | [Context](../../../content/Context.html#): The context of the application This value cannot be `null`. |

Public methods
--------------

### isMediaViewEnabled

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun isMediaViewEnabled(): Boolean
```

Returns `true` if media view is enabled, `false` otherwise.  
**See Also**

- [#setMediaViewEnabled(boolean)](#setMediaViewEnabled(kotlin.Boolean))  

### layoutSurface

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun layoutSurface(
    left: Int, 
    top: Int, 
    right: Int, 
    bottom: Int
): Unit
```

Assigns a size and position to the surface passed in [onSetSurface](#onSetSurface(android.view.Surface)). 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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Left position in pixels, relative to the overlay view.   |
| `top`    | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Top position in pixels, relative to the overlay view.    |
| `right`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Right position in pixels, relative to the overlay view.  |
| `bottom` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Bottom position in pixels, relative to the overlay view. |

### notifyAdBufferReady

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](../AdBuffer.html#): The [AdBuffer](../AdBuffer.html#) to be received This value cannot be `null`. |

### notifyBiInteractiveAppCreated

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: BI interactive app ID, which can be used to destroy the BI interactive app. `null` if it's not created successfully. |
| `biIAppUri` | [Uri](../../../net/Uri.html#): This value cannot be `null`.                                                                                                                                             |

**See Also**

- [#onCreateBiInteractiveAppRequest(Uri, Bundle)](#onCreateBiInteractiveAppRequest(android.net.Uri,%20android.os.Bundle))  

### notifySessionStateChanged

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ||
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `state` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the current session state. Value is [android.media.tv.interactive.TvInteractiveAppManager#INTERACTIVE_APP_STATE_STOPPED](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#INTERACTIVE_APP_STATE_STOPPED:kotlin.Int), [android.media.tv.interactive.TvInteractiveAppManager#INTERACTIVE_APP_STATE_RUNNING](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#INTERACTIVE_APP_STATE_RUNNING:kotlin.Int), or [android.media.tv.interactive.TvInteractiveAppManager#INTERACTIVE_APP_STATE_ERROR](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#INTERACTIVE_APP_STATE_ERROR:kotlin.Int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `err`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the error code for error state. [TvInteractiveAppManager.ERROR_NONE](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#ERROR_NONE:kotlin.Int) is used when the state is not [TvInteractiveAppManager.INTERACTIVE_APP_STATE_ERROR](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#INTERACTIVE_APP_STATE_ERROR:kotlin.Int). Value is [android.media.tv.interactive.TvInteractiveAppManager#ERROR_NONE](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#ERROR_NONE:kotlin.Int), [android.media.tv.interactive.TvInteractiveAppManager#ERROR_UNKNOWN](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#ERROR_UNKNOWN:kotlin.Int), [android.media.tv.interactive.TvInteractiveAppManager#ERROR_NOT_SUPPORTED](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#ERROR_NOT_SUPPORTED:kotlin.Int), [android.media.tv.interactive.TvInteractiveAppManager#ERROR_WEAK_SIGNAL](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#ERROR_WEAK_SIGNAL:kotlin.Int), [android.media.tv.interactive.TvInteractiveAppManager#ERROR_RESOURCE_UNAVAILABLE](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#ERROR_RESOURCE_UNAVAILABLE:kotlin.Int), [android.media.tv.interactive.TvInteractiveAppManager#ERROR_BLOCKED](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#ERROR_BLOCKED:kotlin.Int), [android.media.tv.interactive.TvInteractiveAppManager#ERROR_ENCRYPTED](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#ERROR_ENCRYPTED:kotlin.Int), or [android.media.tv.interactive.TvInteractiveAppManager#ERROR_UNKNOWN_CHANNEL](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#ERROR_UNKNOWN_CHANNEL:kotlin.Int) |

### notifyTeletextAppStateChanged

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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.

|                                                                                                                                                                                                                                                                                                                                              Parameters                                                                                                                                                                                                                                                                                                                                               ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `state` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the current state. Value is [android.media.tv.interactive.TvInteractiveAppManager#TELETEXT_APP_STATE_SHOW](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#TELETEXT_APP_STATE_SHOW:kotlin.Int), [android.media.tv.interactive.TvInteractiveAppManager#TELETEXT_APP_STATE_HIDE](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#TELETEXT_APP_STATE_HIDE:kotlin.Int), or [android.media.tv.interactive.TvInteractiveAppManager#TELETEXT_APP_STATE_ERROR](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppManager#TELETEXT_APP_STATE_ERROR:kotlin.Int) |

### onAdBufferConsumed

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onAdBufferConsumed(buffer: AdBuffer): Unit
```

Called when an advertisement buffer is consumed.

|                                                         Parameters                                                         ||
|----------|------------------------------------------------------------------------------------------------------------------|
| `buffer` | [AdBuffer](../AdBuffer.html#): The [AdBuffer](../AdBuffer.html#) that was consumed. This value cannot be `null`. |

### onAdResponse

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onAdResponse(response: AdResponse): Unit
```

Called when an advertisement response is received.

|                                 Parameters                                  ||
|------------|-----------------------------------------------------------------|
| `response` | [AdResponse](../AdResponse.html#): This value cannot be `null`. |

### onAvailableSpeeds

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onAvailableSpeeds(speeds: FloatArray): Unit
```

Receives available playback speeds.

|                                                                                                                                                                                                                                                                            Parameters                                                                                                                                                                                                                                                                            ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `speeds` | [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html): 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

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onBroadcastInfoResponse(response: BroadcastInfoResponse): Unit
```

Called when a broadcast info response is received.

|                                            Parameters                                             ||
|------------|---------------------------------------------------------------------------------------|
| `response` | [BroadcastInfoResponse](../BroadcastInfoResponse.html#): This value cannot be `null`. |

### onCertificate

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

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

Receives the requested Certificate

|                                                                               Parameters                                                                               ||
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `host` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): the host name of the SSL authentication server. This value cannot be `null`. |
| `port` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the port of the SSL authentication server. E.g., 443                               |
| `cert` | [SslCertificate](../../../net/http/SslCertificate.html#): the SSL certificate received. This value cannot be `null`.                                           |

### onContentAllowed

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onContentAllowed(): Unit
```

Called when content is allowed.  

### onContentBlocked

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onContentBlocked(rating: TvContentRating): Unit
```

Called when content is blocked.

|                                     Parameters                                      ||
|----------|---------------------------------------------------------------------------|
| `rating` | [TvContentRating](../TvContentRating.html#): This value cannot be `null`. |

### onCreateBiInteractiveAppRequest

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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)](#notifyBiInteractiveAppCreated(android.net.Uri,%20kotlin.String)), no matter if it's created successfully or not.

|                                 Parameters                                  ||
|-------------|----------------------------------------------------------------|
| `biIAppUri` | [Uri](../../../net/Uri.html#): This value cannot be `null`.    |
| `params`    | [Bundle](../../../os/Bundle.html#)?: This value may be `null`. |

**See Also**

- [#notifyBiInteractiveAppCreated(Uri, String)](#notifyBiInteractiveAppCreated(android.net.Uri,%20kotlin.String))
- [#onDestroyBiInteractiveAppRequest(String)](#onDestroyBiInteractiveAppRequest(kotlin.String))  

### onCreateMediaView

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](../../../view/View.html#)? | a view attached to the media window This value may be `null`. |

### onCurrentChannelLcn

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onCurrentChannelLcn(lcn: Int): Unit
```

Receives logical channel number (LCN) of current channel.  

### onCurrentChannelUri

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onCurrentChannelUri(channelUri: Uri?): Unit
```

Receives current channel URI.

|                               Parameters                                ||
|--------------|-----------------------------------------------------------|
| `channelUri` | [Uri](../../../net/Uri.html#)?: This value may be `null`. |

### onCurrentTvInputId

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onCurrentTvInputId(inputId: String?): Unit
```

Receives current TV input ID.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `inputId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: This value may be `null`. |

### onCurrentVideoBounds

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onCurrentVideoBounds(bounds: Rect): Unit
```

Receives current video bounds.

|                                                            Parameters                                                            ||
|----------|------------------------------------------------------------------------------------------------------------------------|
| `bounds` | [Rect](../../../graphics/Rect.html#): the rectangle area for rendering the current video. This value cannot be `null`. |

### onDestroyBiInteractiveAppRequest

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onDestroyBiInteractiveAppRequest(biIAppId: String): Unit
```

Destroys broadcast-independent(BI) interactive application.

|                                                                                                                                               Parameters                                                                                                                                               ||
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `biIAppId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): the BI interactive app ID from [onCreateBiInteractiveAppRequest(android.net.Uri,android.os.Bundle)](#onCreateBiInteractiveAppRequest(android.net.Uri,%20android.os.Bundle)) This value cannot be `null`. |

**See Also**

- [#onCreateBiInteractiveAppRequest(Uri, Bundle)](#onCreateBiInteractiveAppRequest(android.net.Uri,%20android.os.Bundle))  

### onError

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onError(
    errMsg: String, 
    params: Bundle
): Unit
```

Called when the application sends information of an error.

|                                                                                                                                                                                                                                                                                                                          Parameters                                                                                                                                                                                                                                                                                                                          ||
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `errMsg` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): the message of the error. This value cannot be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `params` | [Bundle](../../../os/Bundle.html#): 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[])](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView.TvInteractiveAppCallback#onRequestSigning(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.ByteArray)) 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`. |

**See Also**

- [android.media.tv.interactive.TvInteractiveAppView#ERROR_KEY_METHOD_NAME](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#ERROR_KEY_METHOD_NAME:kotlin.String)  

### onGenericMotionEvent

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onGenericMotionEvent(event: MotionEvent): Boolean
```

Implement this method to handle generic motion events on the current session.

|                                                       Parameters                                                       ||
|---------|---------------------------------------------------------------------------------------------------------------|
| `event` | [MotionEvent](../../../view/MotionEvent.html#): The motion event being received. This value cannot be `null`. |

|                                                                                                     Return                                                                                                      ||
|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | 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**

- [android.view.View#onGenericMotionEvent](../../../view/View.html#onGenericMotionEvent(android.view.MotionEvent))  

### onKeyDown

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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()](../../../view/KeyEvent.html#startTracking()) to have the framework track the event through its [onKeyUp(int,android.view.KeyEvent)](../../../view/KeyEvent.Callback.html#onKeyUp(kotlin.Int,%20android.view.KeyEvent)) and also call your [onKeyLongPress(int,android.view.KeyEvent)](../../../view/KeyEvent.Callback.html#onKeyLongPress(kotlin.Int,%20android.view.KeyEvent)) if it occurs.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `keyCode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The value in event.getKeyCode(). |
| `event`   | [KeyEvent](../../../view/KeyEvent.html#): This value cannot be `null`.                                       |

|                                                                                                   Return                                                                                                    ||
|------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. |

### onKeyLongPress

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](../../../view/KeyEvent.html#FLAG_CANCELED:kotlin.Int) and [KeyEvent.FLAG_CANCELED_LONG_PRESS](../../../view/KeyEvent.html#FLAG_CANCELED_LONG_PRESS:kotlin.Int) set. Note that in order to receive this callback, someone in the event change *must* return true from [onKeyDown](../../../view/KeyEvent.Callback.html#onKeyDown(kotlin.Int,%20android.view.KeyEvent)) *and* call [KeyEvent.startTracking()](../../../view/KeyEvent.html#startTracking()) on the event.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `keyCode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The value in event.getKeyCode(). |
| `event`   | [KeyEvent](../../../view/KeyEvent.html#): This value cannot be `null`.                                       |

|                                                                                                   Return                                                                                                    ||
|------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. |

### onKeyMultiple

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The value in event.getKeyCode().                       |
| `count`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Number of pairs as returned by event.getRepeatCount(). |
| `event`   | [KeyEvent](../../../view/KeyEvent.html#): This value cannot be `null`.                                                             |

|                                                                                                   Return                                                                                                    ||
|------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. |

### onKeyUp

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onKeyUp(
    keyCode: Int, 
    event: KeyEvent
): Boolean
```

Called when a key up event has occurred.

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `keyCode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The value in event.getKeyCode(). |
| `event`   | [KeyEvent](../../../view/KeyEvent.html#): This value cannot be `null`.                                       |

|                                                                                                   Return                                                                                                    ||
|------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false. |

### onMediaViewSizeChanged

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView). Note that the size of the underlying surface can be different if the surface was changed by calling [layoutSurface](#layoutSurface(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int)).

|                                                                             Parameters                                                                             ||
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `width`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The width of the media view, in pixels. The units of this value are pixels.  |
| `height` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The height of the media view, in pixels. The units of this value are pixels. |

### onRecordingConnectionFailed

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the related recording which is sent via [TvInteractiveAppView.notifyRecordingStarted(String, String)](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(kotlin.String,%20kotlin.String)) This value cannot be `null`. |
| `inputId`     | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the TV input bound to the current TvRecordingClient. This value cannot be `null`.                                                                                                                                                                              |

**See Also**

- [android.media.tv.TvRecordingClient.RecordingCallback#onConnectionFailed(String)](../TvRecordingClient.RecordingCallback.html#onConnectionFailed(kotlin.String))  

### onRecordingDisconnected

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onRecordingDisconnected(
    recordingId: String, 
    inputId: String
): Unit
```

This is called when the connection to the current recording session is lost.

|                                                                                                                                                                                Parameters                                                                                                                                                                                 ||
|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `recordingId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the related recording which is sent via [TvInteractiveAppView.notifyRecordingStarted(String, String)](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(kotlin.String,%20kotlin.String)) This value cannot be `null`. |
| `inputId`     | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the TV input bound to the current TvRecordingClient. This value cannot be `null`.                                                                                                                                                                              |

**See Also**

- [android.media.tv.TvRecordingClient.RecordingCallback#onDisconnected(String)](../TvRecordingClient.RecordingCallback.html#onDisconnected(kotlin.String))  

### onRecordingError

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the related recording which is sent via [TvInteractiveAppView.notifyRecordingStarted(String, String)](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(kotlin.String,%20kotlin.String)) This value cannot be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `err`         | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The error code. Should be one of the following. - [TvInputManager.RECORDING_ERROR_UNKNOWN](../TvInputManager.html#RECORDING_ERROR_UNKNOWN:kotlin.Int) - [TvInputManager.RECORDING_ERROR_INSUFFICIENT_SPACE](../TvInputManager.html#RECORDING_ERROR_INSUFFICIENT_SPACE:kotlin.Int) - [TvInputManager.RECORDING_ERROR_RESOURCE_BUSY](../TvInputManager.html#RECORDING_ERROR_RESOURCE_BUSY:kotlin.Int) Value is [android.media.tv.TvInputManager#RECORDING_ERROR_UNKNOWN](../TvInputManager.html#RECORDING_ERROR_UNKNOWN:kotlin.Int), [android.media.tv.TvInputManager#RECORDING_ERROR_INSUFFICIENT_SPACE](../TvInputManager.html#RECORDING_ERROR_INSUFFICIENT_SPACE:kotlin.Int), or [android.media.tv.TvInputManager#RECORDING_ERROR_RESOURCE_BUSY](../TvInputManager.html#RECORDING_ERROR_RESOURCE_BUSY:kotlin.Int) |

**See Also**

- [android.media.tv.TvRecordingClient.RecordingCallback#onError(int)](../TvRecordingClient.RecordingCallback.html#onError(kotlin.Int))  

### onRecordingScheduled

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onRecordingScheduled(
    recordingId: String, 
    requestId: String?
): Unit
```

This is called when the recording has been scheduled.

|                                                                                                                                                                                     Parameters                                                                                                                                                                                     ||
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `recordingId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID assigned to this recording by the app. It can be used to send recording related requests such as [requestStopRecording(java.lang.String)](#requestStopRecording(kotlin.String)). This value cannot be `null`.                                                              |
| `requestId`   | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: 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](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService) and can be any string. |

### onRecordingStarted

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): 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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: The ID of the request when [requestStartRecording(java.lang.String,android.net.Uri)](#requestStartRecording(kotlin.String,%20android.net.Uri)) is called. `null` if the recording is not triggered by a [requestStartRecording(java.lang.String,android.net.Uri)](#requestStartRecording(kotlin.String,%20android.net.Uri)) request. This ID should be created by the [TvInteractiveAppService](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService) and can be any string. |

**See Also**

- [#onRecordingStopped(String)](#onRecordingStopped(kotlin.String))  

### onRecordingStopped

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onRecordingStopped(recordingId: String): Unit
```

This is called when the recording has been stopped.

|                                                                                                                   Parameters                                                                                                                   ||
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `recordingId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): 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**

- [#onRecordingStarted(String, String)](#onRecordingStarted(kotlin.String,%20kotlin.String))  

### onRecordingTuned

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the related recording which is sent via [TvInteractiveAppView.notifyRecordingStarted(String, String)](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(kotlin.String,%20kotlin.String)) This value cannot be `null`. |
| `channelUri`  | [Uri](../../../net/Uri.html#): The URI of the tuned channel. This value cannot be `null`.                                                                                                                                                                                                                                                                  |

**See Also**

- [android.media.tv.TvRecordingClient.RecordingCallback#onTuned(Uri)](../TvRecordingClient.RecordingCallback.html#onTuned(android.net.Uri))  

### onRelease

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract fun onRelease(): Unit
```

Releases TvInteractiveAppService session.  

### onResetInteractiveApp

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onResetInteractiveApp(): Unit
```

Resets TvInteractiveAppService session.  

### onSelectedTrackInfo

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onSelectedTrackInfo(tracks: MutableList<TvTrackInfo!>): Unit
```

Called when the TV App sends the selected track info as a response to [requestSelectedTrackInfo()](#requestSelectedTrackInfo()).

When a selected track changes as a result of a new selection, [onTrackSelected(int,java.lang.String)](#onTrackSelected(kotlin.Int,%20kotlin.String)) should be used instead to communicate the specific track selection.

|                                                                                                                            Parameters                                                                                                                             ||
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tracks` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[TvTrackInfo](../TvTrackInfo.html#)!\>: A list of [TvTrackInfo](../TvTrackInfo.html#) that are currently selected This value cannot be `null`. |

### onSetSurface

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](../../../view/Surface.html#)?: The surface to be used for interactive app UI rendering. Can be `null`. |

|                                                                       Return                                                                       ||
|------------------------------------------------------------------------------------|----------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true` if the surface was set successfully, `false` otherwise. |

### onSetTeletextAppEnabled

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onSetTeletextAppEnabled(enable: Boolean): Unit
```

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

|                                                                   Parameters                                                                    ||
|----------|---------------------------------------------------------------------------------------------------------------------------------------|
| `enable` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` to enable teletext app; `false` otherwise. |

### onSignalStrength

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onSignalStrength(strength: Int): Unit
```

Called when signal strength is changed.

|                                                                                                                                                                                                                       Parameters                                                                                                                                                                                                                       ||
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `strength` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is [android.media.tv.TvInputManager#SIGNAL_STRENGTH_LOST](../TvInputManager.html#SIGNAL_STRENGTH_LOST:kotlin.Int), [android.media.tv.TvInputManager#SIGNAL_STRENGTH_WEAK](../TvInputManager.html#SIGNAL_STRENGTH_WEAK:kotlin.Int), or [android.media.tv.TvInputManager#SIGNAL_STRENGTH_STRONG](../TvInputManager.html#SIGNAL_STRENGTH_STRONG:kotlin.Int) |

### onSigningResult

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onSigningResult(
    signingId: String, 
    result: ByteArray
): Unit
```

Receives signing result.

|                                                                                                                                                                     Parameters                                                                                                                                                                      ||
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `signingId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): the ID to identify the request. It's the same as the corresponding ID in [Session.requestSigning(String, String, String, byte[])](#requestSigning(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.ByteArray)) This value cannot be `null`. |
| `result`    | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): the signed result. This value cannot be `null`.                                                                                                                                                                                               |

**See Also**

- [#requestSigning(String, String, String, byte[])](#requestSigning(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.ByteArray))  

### onStartInteractiveApp

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onStartInteractiveApp(): Unit
```

Starts TvInteractiveAppService session.  

### onStopInteractiveApp

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onStopInteractiveApp(): Unit
```

Stops TvInteractiveAppService session.  

### onStreamVolume

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onStreamVolume(volume: Float): Unit
```

Receives current stream volume.

|                                                                   Parameters                                                                   ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------|
| `volume` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html): a volume value between `0.0f` and `1.0f`, inclusive. |

### onSurfaceChanged

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](#onSetSurface(android.view.Surface)). This method is always called at least once, after [onSetSurface](#onSetSurface(android.view.Surface)) is called with non-null surface.

|                                                                                                                                                                                                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                                                                                                                                                                                                          ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `format` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new [PixelFormat](../../../graphics/PixelFormat.html#) of the surface. Value is [android.graphics.PixelFormat#RGBA_8888](../../../graphics/PixelFormat.html#RGBA_8888:kotlin.Int), [android.graphics.PixelFormat#RGBX_8888](../../../graphics/PixelFormat.html#RGBX_8888:kotlin.Int), [android.graphics.PixelFormat#RGBA_F16](../../../graphics/PixelFormat.html#RGBA_F16:kotlin.Int), [android.graphics.PixelFormat#RGBA_1010102](../../../graphics/PixelFormat.html#RGBA_1010102:kotlin.Int), [android.graphics.PixelFormat#RGB_888](../../../graphics/PixelFormat.html#RGB_888:kotlin.Int), [android.graphics.PixelFormat#RGB_565](../../../graphics/PixelFormat.html#RGB_565:kotlin.Int), or android.graphics.PixelFormat.R_8 |
| `width`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new width of the surface.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `height` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new height of the surface.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

### onTimeShiftCurrentPositionChanged

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTimeShiftCurrentPositionChanged(
    inputId: String, 
    timeMs: Long
): Unit
```

Called when time shift current position is changed.

|                                                                                              Parameters                                                                                              ||
|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `inputId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the input for which the time shift current position has changed. This value cannot be `null`. |
| `timeMs`  | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The current position for time shifting, in milliseconds since the epoch.                                    |

**See Also**

- [android.media.tv.TvView.TimeShiftPositionCallback#onTimeShiftCurrentPositionChanged(String, long)](../TvView.TimeShiftPositionCallback.html#onTimeShiftCurrentPositionChanged(kotlin.String,%20kotlin.Long))  

### onTimeShiftMode

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTimeShiftMode(mode: Int): Unit
```

Receives current time shift mode.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ||
|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `mode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The current time shift mode. The value is one of the following: [TvInputManager.TIME_SHIFT_MODE_OFF](../TvInputManager.html#TIME_SHIFT_MODE_OFF:kotlin.Int), [TvInputManager.TIME_SHIFT_MODE_LOCAL](../TvInputManager.html#TIME_SHIFT_MODE_LOCAL:kotlin.Int), [TvInputManager.TIME_SHIFT_MODE_NETWORK](../TvInputManager.html#TIME_SHIFT_MODE_NETWORK:kotlin.Int), [TvInputManager.TIME_SHIFT_MODE_AUTO](../TvInputManager.html#TIME_SHIFT_MODE_AUTO:kotlin.Int). Value is [android.media.tv.TvInputManager#TIME_SHIFT_MODE_OFF](../TvInputManager.html#TIME_SHIFT_MODE_OFF:kotlin.Int), [android.media.tv.TvInputManager#TIME_SHIFT_MODE_LOCAL](../TvInputManager.html#TIME_SHIFT_MODE_LOCAL:kotlin.Int), [android.media.tv.TvInputManager#TIME_SHIFT_MODE_NETWORK](../TvInputManager.html#TIME_SHIFT_MODE_NETWORK:kotlin.Int), or [android.media.tv.TvInputManager#TIME_SHIFT_MODE_AUTO](../TvInputManager.html#TIME_SHIFT_MODE_AUTO:kotlin.Int) |

### onTimeShiftPlaybackParams

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTimeShiftPlaybackParams(params: PlaybackParams): Unit
```

Called when the time shift [android.media.PlaybackParams](../../PlaybackParams.html#) is set or changed.

|                                                                             Parameters                                                                             ||
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `params` | [PlaybackParams](../../PlaybackParams.html#): The new [PlaybackParams](../../PlaybackParams.html#) that was set or changed. This value cannot be `null`. |

**See Also**

- [android.media.tv.TvView#timeShiftSetPlaybackParams(PlaybackParams)](../TvView.html#timeShiftSetPlaybackParams(android.media.PlaybackParams))  

### onTimeShiftStartPositionChanged

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTimeShiftStartPositionChanged(
    inputId: String, 
    timeMs: Long
): Unit
```

Called when time shift start position is changed.

|                                                                                             Parameters                                                                                             ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `inputId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the input for which the time shift start position has changed. This value cannot be `null`. |
| `timeMs`  | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The start position for time shifting, in milliseconds since the epoch.                                    |

**See Also**

- [android.media.tv.TvView.TimeShiftPositionCallback#onTimeShiftStartPositionChanged(String, long)](../TvView.TimeShiftPositionCallback.html#onTimeShiftStartPositionChanged(kotlin.String,%20kotlin.Long))  

### onTimeShiftStatusChanged

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTimeShiftStatusChanged(
    inputId: String, 
    status: Int
): Unit
```

Called when time shift status is changed.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ||
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `inputId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the input for which the time shift status has changed. This value cannot be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `status`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The status of which the input has changed to. Should be one of the following. - [TvInputManager.TIME_SHIFT_STATUS_UNKNOWN](../TvInputManager.html#TIME_SHIFT_STATUS_UNKNOWN:kotlin.Int) - [TvInputManager.TIME_SHIFT_STATUS_UNSUPPORTED](../TvInputManager.html#TIME_SHIFT_STATUS_UNSUPPORTED:kotlin.Int) - [TvInputManager.TIME_SHIFT_STATUS_UNAVAILABLE](../TvInputManager.html#TIME_SHIFT_STATUS_UNAVAILABLE:kotlin.Int) - [TvInputManager.TIME_SHIFT_STATUS_AVAILABLE](../TvInputManager.html#TIME_SHIFT_STATUS_AVAILABLE:kotlin.Int) Value is [android.media.tv.TvInputManager#TIME_SHIFT_STATUS_UNKNOWN](../TvInputManager.html#TIME_SHIFT_STATUS_UNKNOWN:kotlin.Int), [android.media.tv.TvInputManager#TIME_SHIFT_STATUS_UNSUPPORTED](../TvInputManager.html#TIME_SHIFT_STATUS_UNSUPPORTED:kotlin.Int), [android.media.tv.TvInputManager#TIME_SHIFT_STATUS_UNAVAILABLE](../TvInputManager.html#TIME_SHIFT_STATUS_UNAVAILABLE:kotlin.Int), or [android.media.tv.TvInputManager#TIME_SHIFT_STATUS_AVAILABLE](../TvInputManager.html#TIME_SHIFT_STATUS_AVAILABLE:kotlin.Int) |

**See Also**

- [android.media.tv.TvView.TvInputCallback#onTimeShiftStatusChanged(String, int)](../TvView.TvInputCallback.html#onTimeShiftStatusChanged(kotlin.String,%20kotlin.Int))
- [android.media.tv.TvInputService.Session#notifyTimeShiftStatusChanged(int)](../TvInputService.Session.html#notifyTimeShiftStatusChanged(kotlin.Int))  

### onTouchEvent

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTouchEvent(event: MotionEvent): Boolean
```

Implement this method to handle touch screen motion events on the current session.

|                                                       Parameters                                                       ||
|---------|---------------------------------------------------------------------------------------------------------------|
| `event` | [MotionEvent](../../../view/MotionEvent.html#): The motion event being received. This value cannot be `null`. |

|                                                                                                     Return                                                                                                      ||
|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | 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**

- [android.view.View#onTouchEvent](../../../view/View.html#onTouchEvent(android.view.MotionEvent))  

### onTrackInfoList

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTrackInfoList(tracks: MutableList<TvTrackInfo!>): Unit
```

Receives track list.

|                                                                                       Parameters                                                                                        ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tracks` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[TvTrackInfo](../TvTrackInfo.html#)!\>: This value cannot be `null`. |

### onTrackSelected

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is [android.media.tv.TvTrackInfo#TYPE_AUDIO](../TvTrackInfo.html#TYPE_AUDIO:kotlin.Int), [android.media.tv.TvTrackInfo#TYPE_VIDEO](../TvTrackInfo.html#TYPE_VIDEO:kotlin.Int), or [android.media.tv.TvTrackInfo#TYPE_SUBTITLE](../TvTrackInfo.html#TYPE_SUBTITLE:kotlin.Int) |
| `trackId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): This value cannot be `null`.                                                                                                                                                                                                                                                 |

### onTrackballEvent

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTrackballEvent(event: MotionEvent): Boolean
```

Implement this method to handle trackball events on the current session.

|                                                       Parameters                                                       ||
|---------|---------------------------------------------------------------------------------------------------------------|
| `event` | [MotionEvent](../../../view/MotionEvent.html#): The motion event being received. This value cannot be `null`. |

|                                                                                                     Return                                                                                                      ||
|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | 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**

- [android.view.View#onTrackballEvent](../../../view/View.html#onTrackballEvent(android.view.MotionEvent))  

### onTracksChanged

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTracksChanged(tracks: MutableList<TvTrackInfo!>): Unit
```

Called when the tracks are changed.

|                                                                                       Parameters                                                                                        ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tracks` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[TvTrackInfo](../TvTrackInfo.html#)!\>: This value cannot be `null`. |

### onTuned

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTuned(channelUri: Uri): Unit
```

Called when the corresponding TV input tuned to a channel.

|                                            Parameters                                            ||
|--------------|------------------------------------------------------------------------------------|
| `channelUri` | [Uri](../../../net/Uri.html#): The tuned channel URI. This value cannot be `null`. |

### onTvMessage

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTvMessage(
    type: Int, 
    data: Bundle
): Unit
```

Called when a TV message is received

|                                                                                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                                                                                      ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The type of message received, such as [TvInputManager.TV_MESSAGE_TYPE_WATERMARK](../TvInputManager.html#TV_MESSAGE_TYPE_WATERMARK:kotlin.Int) Value is [android.media.tv.TvInputManager#TV_MESSAGE_TYPE_WATERMARK](../TvInputManager.html#TV_MESSAGE_TYPE_WATERMARK:kotlin.Int), [android.media.tv.TvInputManager#TV_MESSAGE_TYPE_CLOSED_CAPTION](../TvInputManager.html#TV_MESSAGE_TYPE_CLOSED_CAPTION:kotlin.Int), or [android.media.tv.TvInputManager#TV_MESSAGE_TYPE_OTHER](../TvInputManager.html#TV_MESSAGE_TYPE_OTHER:kotlin.Int)                                                                                        |
| `data` | [Bundle](../../../os/Bundle.html#): The raw data of the message. The bundle keys are: [TvInputManager.TV_MESSAGE_KEY_STREAM_ID](../TvInputManager.html#TV_MESSAGE_KEY_STREAM_ID:kotlin.String), [TvInputManager.TV_MESSAGE_KEY_GROUP_ID](../TvInputManager.html#TV_MESSAGE_KEY_GROUP_ID:kotlin.String), [TvInputManager.TV_MESSAGE_KEY_SUBTYPE](../TvInputManager.html#TV_MESSAGE_KEY_SUBTYPE:kotlin.String), [TvInputManager.TV_MESSAGE_KEY_RAW_DATA](../TvInputManager.html#TV_MESSAGE_KEY_RAW_DATA:kotlin.String). See [TvInputManager.TV_MESSAGE_KEY_SUBTYPE](../TvInputManager.html#TV_MESSAGE_KEY_SUBTYPE:kotlin.String) for more information on how to parse this data. This value cannot be `null`. |

### onTvRecordingInfo

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTvRecordingInfo(recordingInfo: TvRecordingInfo?): Unit
```

Receives the requested [android.media.tv.TvRecordingInfo](../TvRecordingInfo.html#).

|                                                         Parameters                                                         ||
|-----------------|-----------------------------------------------------------------------------------------------------------|
| `recordingInfo` | [TvRecordingInfo](../TvRecordingInfo.html#)?: The requested recording info. `null` if no recording found. |

**See Also**

- [#requestTvRecordingInfo(String)](#requestTvRecordingInfo(kotlin.String))  

### onTvRecordingInfoList

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onTvRecordingInfoList(recordingInfoList: MutableList<TvRecordingInfo!>): Unit
```

Receives requested recording info list.

|                                                                                                                                                 Parameters                                                                                                                                                  ||
|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `recordingInfoList` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[TvRecordingInfo](../TvRecordingInfo.html#)!\>: The list of recording info requested. Returns an empty list if no matching recording info found. This value cannot be `null`. |

**See Also**

- [#requestTvRecordingInfoList(int)](#requestTvRecordingInfoList(kotlin.Int))  

### onVideoAvailable

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onVideoAvailable(): Unit
```

Called when video is available.  

### onVideoFreezeUpdated

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onVideoFreezeUpdated(isFrozen: Boolean): Unit
```

Called when video becomes frozen or unfrozen. Audio playback will continue while video will be frozen to the last frame if `true`.

|                                                             Parameters                                                              ||
|------------|-------------------------------------------------------------------------------------------------------------------------|
| `isFrozen` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether or not the video is frozen. |

### onVideoUnavailable

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onVideoUnavailable(reason: Int): Unit
```

Called when video is unavailable.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ||
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `reason` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_UNKNOWN](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_UNKNOWN:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_TUNING](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_TUNING:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_BUFFERING](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_BUFFERING:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_INSUFFICIENT_RESOURCE](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_INSUFFICIENT_RESOURCE:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED:kotlin.Int), android.media.tv.TvInputManager.VIDEO_UNAVAILABLE_REASON_CAS_NO_LICENSE, [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_LICENSE_EXPIRED](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_LICENSE_EXPIRED:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_NEED_ACTIVATION](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_NEED_ACTIVATION:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_NEED_PAIRING](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_NEED_PAIRING:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_NO_CARD](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_NO_CARD:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_CARD_MUTE](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_CARD_MUTE:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_CARD_INVALID](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_CARD_INVALID:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING:kotlin.Int), [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN:kotlin.Int), or [android.media.tv.TvInputManager#VIDEO_UNAVAILABLE_REASON_STOPPED](../TvInputManager.html#VIDEO_UNAVAILABLE_REASON_STOPPED:kotlin.Int) |

### removeBroadcastInfo

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the ID of the request |

### requestAd

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](../AdRequest.html#): The advertisement request This value cannot be `null`. |

### requestAvailableSpeeds

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestAvailableSpeeds(): Unit
```

Requests available speeds for time shift.   
If you override this method you *must* call through to the superclass implementation.  

### requestBroadcastInfo

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](../BroadcastInfoRequest.html#): the request for broadcast info This value cannot be `null`. |

### requestCertificate

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestCertificate(
    host: String, 
    port: Int
): Unit
```

Requests a SSL certificate for client validation.   
If you override this method you *must* call through to the superclass implementation.

|                                                                               Parameters                                                                               ||
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `host` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): the host name of the SSL authentication server. This value cannot be `null`. |
| `port` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the port of the SSL authentication server. E.g., 443                               |

### requestCurrentChannelLcn

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestCurrentTvInputId(): Unit
```

Requests current TV input ID.   
If you override this method you *must* call through to the superclass implementation.  
**See Also**

- [android.media.tv.TvInputInfo](../TvInputInfo.html#)  

### requestCurrentVideoBounds

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of this request which is used to match the corresponding response. The request ID in [onRecordingScheduled(java.lang.String,java.lang.String)](#onRecordingScheduled(kotlin.String,%20kotlin.String)) for this request is the same as the ID sent here. This should be defined by the [TvInteractiveAppService](/reference/kotlin/android/media/tv/interactive/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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the TV input for the given channel. This value cannot be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `channelUri` | [Uri](../../../net/Uri.html#): The URI of a channel to be recorded. This value cannot be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `programUri` | [Uri](../../../net/Uri.html#): The URI of the TV program to be recorded. This value cannot be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `params`     | [Bundle](../../../os/Bundle.html#): 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`.                                                                                                                                                                                                                                                                                                                                                                                                            |

**See Also**

- [android.media.tv.TvRecordingClient#tune(String, Uri, Bundle)](../TvRecordingClient.html#tune(kotlin.String,%20android.net.Uri,%20android.os.Bundle))
- [android.media.tv.TvRecordingClient#startRecording(Uri)](../TvRecordingClient.html#startRecording(android.net.Uri))  

### requestScheduleRecording

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of this request which is used to match the corresponding response. The request ID in [onRecordingScheduled(java.lang.String,java.lang.String)](#onRecordingScheduled(kotlin.String,%20kotlin.String)) for this request is the same as the ID sent here. This should be defined by the [TvInteractiveAppService](/reference/kotlin/android/media/tv/interactive/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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the TV input for the given channel. This value cannot be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `channelUri` | [Uri](../../../net/Uri.html#): The URI of a channel to be recorded. This value cannot be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `startTime`  | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The start time of the recording in milliseconds since epoch.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `duration`   | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The duration of the recording in milliseconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `repeatDays` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The repeated days. 0 if not repeated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `params`     | [Bundle](../../../os/Bundle.html#): 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`.                                                                                                                                                                                                                                                                                                                                                                                                            |

**See Also**

- [android.media.tv.TvRecordingClient#tune(String, Uri, Bundle)](../TvRecordingClient.html#tune(kotlin.String,%20android.net.Uri,%20android.os.Bundle))
- [android.media.tv.TvRecordingClient#startRecording(Uri)](../TvRecordingClient.html#startRecording(android.net.Uri))  

### requestSelectedTrackInfo

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestSelectedTrackInfo(): Unit
```

Requests a list of the currently selected [TvTrackInfo](../TvTrackInfo.html#) from the TV App.

Normally, track info cannot be synchronized until the channel has been changed. This is used when the session of the [TvInteractiveAppService](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService) is newly created and the normal synchronization has not happened yet.

The track info will be returned in [onSelectedTrackInfo(java.util.List)](#onSelectedTrackInfo(kotlin.collections.MutableList))   
If you override this method you *must* call through to the superclass implementation.  

### requestSigning

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): 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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): 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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): the alias of the corresponding [java.security.KeyStore](../../../../java/security/KeyStore.html#). This value cannot be `null`.                                                          |
| `data`      | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): the original bytes to be signed. This value cannot be `null`.                                                                                                                     |

**See Also**

- [#onSigningResult(String, byte[])](#onSigningResult(kotlin.String,%20kotlin.ByteArray))
- [android.media.tv.interactive.TvInteractiveAppView#createBiInteractiveApp(Uri, Bundle)](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#createBiInteractiveApp(android.net.Uri,%20android.os.Bundle))
- [android.media.tv.interactive.TvInteractiveAppView#BI_INTERACTIVE_APP_KEY_ALIAS](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#BI_INTERACTIVE_APP_KEY_ALIAS:kotlin.String)  

### requestSigning

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestSigning(
    signingId: String, 
    algorithm: String, 
    host: String, 
    port: Int, 
    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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): 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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): 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`. |
| `host`      | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): the host of the SSL client authentication server. This value cannot be `null`.                                                                                                           |
| `port`      | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the port of the SSL client authentication server.                                                                                                                                              |
| `data`      | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): the original bytes to be signed. This value cannot be `null`.                                                                                                                     |

**See Also**

- [#onSigningResult(String, byte[])](#onSigningResult(kotlin.String,%20kotlin.ByteArray))
- [android.media.tv.interactive.TvInteractiveAppView#createBiInteractiveApp(Uri, Bundle)](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#createBiInteractiveApp(android.net.Uri,%20android.os.Bundle))
- [android.media.tv.interactive.TvInteractiveAppView#BI_INTERACTIVE_APP_KEY_ALIAS](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#BI_INTERACTIVE_APP_KEY_ALIAS:kotlin.String)  

### requestStartRecording

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestStartRecording(
    requestId: String, 
    programUri: Uri?
): Unit
```

Requests starting of recording

This is used to request the active [android.media.tv.TvRecordingClient](../TvRecordingClient.html#) to call [android.media.tv.TvRecordingClient#startRecording(Uri)](../TvRecordingClient.html#startRecording(android.net.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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of this request which is used to match the corresponding response. The request ID in [onRecordingStarted(java.lang.String,java.lang.String)](#onRecordingStarted(kotlin.String,%20kotlin.String)) for this request is the same as the ID sent here. This should be defined by the [TvInteractiveAppService](/reference/kotlin/android/media/tv/interactive/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](../../../net/Uri.html#)?: The URI for the TV program to record, built by [TvContract.buildProgramUri(long)](../TvContract.html#buildProgramUri(kotlin.Long)). Can be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

**See Also**

- [android.media.tv.TvRecordingClient#startRecording(Uri)](../TvRecordingClient.html#startRecording(android.net.Uri))  

### requestStopRecording

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](../TvRecordingClient.html#) to call [android.media.tv.TvRecordingClient#stopRecording()](../TvRecordingClient.html#stopRecording()).   
If you override this method you *must* call through to the superclass implementation.

|                                                                                                                                                                                         Parameters                                                                                                                                                                                         ||
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `recordingId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the recording to stop. This is provided by the TV app in [TvInteractiveAppView.notifyRecordingStarted(String, String)](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(kotlin.String,%20kotlin.String)) This value cannot be `null`. |

**See Also**

- [android.media.tv.TvRecordingClient#stopRecording()](../TvRecordingClient.html#stopRecording())  

### requestStreamVolume

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestStreamVolume(): Unit
```

Requests stream volume.   
If you override this method you *must* call through to the superclass implementation.  

### requestTimeShiftMode

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestTimeShiftMode(): Unit
```

Requests time shift mode.   
If you override this method you *must* call through to the superclass implementation.  

### requestTrackInfoList

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestTrackInfoList(): Unit
```

Requests the list of [TvTrackInfo](../TvTrackInfo.html#).   
If you override this method you *must* call through to the superclass implementation.  

### requestTvRecordingInfo

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the recording to set the info for. This is provided by the TV app in [TvInteractiveAppView.notifyRecordingStarted(String, String)](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(kotlin.String,%20kotlin.String)) This value cannot be `null`. |

### requestTvRecordingInfoList

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun requestTvRecordingInfoList(type: Int): Unit
```

Gets a list of [TvRecordingInfo](../TvRecordingInfo.html#) for the specified recording type.   
If you override this method you *must* call through to the superclass implementation.

|                                                                                                                                                                                                                                Parameters                                                                                                                                                                                                                                 ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The type of recording to retrieve. Value is [android.media.tv.TvRecordingInfo#RECORDING_SCHEDULED](../TvRecordingInfo.html#RECORDING_SCHEDULED:kotlin.Int), [android.media.tv.TvRecordingInfo#RECORDING_IN_PROGRESS](../TvRecordingInfo.html#RECORDING_IN_PROGRESS:kotlin.Int), or [android.media.tv.TvRecordingInfo#RECORDING_ALL](../TvRecordingInfo.html#RECORDING_ALL:kotlin.Int) |

### sendPlaybackCommandRequest

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): type of the specific command Value is [android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE:kotlin.String), [android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE_NEXT](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE_NEXT:kotlin.String), [android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE_PREV](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_TUNE_PREV:kotlin.String), [android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_STOP](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_STOP:kotlin.String), [android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_SET_STREAM_VOLUME](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_SET_STREAM_VOLUME:kotlin.String), [android.media.tv.interactive.TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_SELECT_TRACK](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#PLAYBACK_COMMAND_TYPE_SELECT_TRACK:kotlin.String), or android.media.tv.interactive.TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_FREEZE This value cannot be `null`. |
| `parameters` | [Bundle](../../../os/Bundle.html#)?: parameters of the specific command This value may be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

### sendTimeShiftCommandRequest

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): type of the specific command Value is [android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_PLAY](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_PLAY:kotlin.String), [android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_PAUSE](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_PAUSE:kotlin.String), [android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_RESUME](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_RESUME:kotlin.String), [android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SEEK_TO](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SEEK_TO:kotlin.String), [android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SET_PLAYBACK_PARAMS](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SET_PLAYBACK_PARAMS:kotlin.String), or [android.media.tv.interactive.TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SET_MODE](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppService#TIME_SHIFT_COMMAND_TYPE_SET_MODE:kotlin.String) This value cannot be `null`. |
| `parameters` | [Bundle](../../../os/Bundle.html#)?: parameters of the specific command This value may be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

### setMediaViewEnabled

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): `true` if you want to enable the media view. `false` otherwise. |

### setTvRecordingInfo

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The ID of the recording to set the info for. This is provided by the TV app in [TvInteractiveAppView.notifyRecordingStarted(String, String)](/reference/kotlin/android/media/tv/interactive/TvInteractiveAppView#notifyRecordingStarted(kotlin.String,%20kotlin.String)) This value cannot be `null`. |
| `recordingInfo` | [TvRecordingInfo](../TvRecordingInfo.html#): The [TvRecordingInfo](../TvRecordingInfo.html#) to set to the recording. This value cannot be `null`.                                                                                                                                                                                                                                      |

### setVideoBounds

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](../../../graphics/Rect.html#): This value cannot be `null`. |