Added in API level 21

TvView


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

Displays TV contents. The TvView class provides a high level interface for applications to show TV programs from various TV sources that implement TvInputService. (Note that the list of TV inputs available on the system can be obtained by calling TvInputManager.getTvInputList().)

Once the application supplies the URI for a specific TV channel to #tune method, it takes care of underlying service binding (and unbinding if the current TvView is already bound to a service) and automatically allocates/deallocates resources needed. In addition to a few essential methods to control how the contents are presented, it also provides a way to dispatch input events to the connected TvInputService in order to enable custom key actions for the TV input.

Summary

Nested classes
abstract

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

abstract

Callback used to receive time shift position changes.

abstract

Callback used to receive various status updates on the TvView.

Inherited XML attributes
Inherited constants
Public constructors
TvView(context: Context!)

TvView(context: Context!, attrs: AttributeSet!)

TvView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

Public methods
open Boolean

Dispatch a generic motion event.

open Boolean

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

open Boolean

Pass the touch screen motion event down to the target view, or this view if it is the target.

open Boolean

Pass a trackball motion event down to the focused view.

open Boolean

Dispatches an unhandled input event to the next receiver.

open Unit

Called when the window containing this view gains or loses window focus.

open Unit
draw(canvas: Canvas)

Manually render this view (and all of its children) to the given Canvas.

open Boolean

This is used by the ViewRoot to perform an optimization when the view hierarchy contains one or several SurfaceView.

open MutableList<AudioPresentation!>

Returns the list of audio presentations from the selected track of type TvTrackInfo.TYPE_AUDIO.

open String!

Returns the ID of the selected track for a given type.

open MutableList<TvTrackInfo!>!
getTracks(type: Int)

Returns the list of tracks.

open Boolean

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

open Unit

Override default attribution source of TV App.

open Unit

Resets this TvView.

open Unit

Resumes playback of the Audio, Video, and CC streams.

open Unit
selectAudioPresentation(presentationId: Int, programId: Int)

Selects an audio presentation.

open Unit
selectTrack(type: Int, trackId: String!)

Selects a track.

open Unit

Sends a private command to the underlying TV input.

open Unit

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

open Unit

Enables or disables the caption in this TvView.

open Unit

Enables or disables interactive app notification.

open Unit

Registers a callback to be invoked when an input event is not handled by the bound TV input.

open Unit

Sets the relative stream volume of this TvView.

open Unit

Sets the callback to be invoked when the time shift position is changed.

open Unit
setTvMessageEnabled(type: Int, enabled: Boolean)

Enables or disables TV message detection in the stream of the bound TV input.

open Unit

Sets whether or not the video is frozen.

open Unit
setZOrderMediaOverlay(isMediaOverlay: Boolean)

Controls whether the TvView's surface is placed on top of another regular surface view in the window (but still behind the window itself).

open Unit

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

open Unit

Stops playback of the Audio, Video, and CC streams, but continue filtering the metadata.

open Unit

Pauses playback.

open Unit
timeShiftPlay(inputId: String!, recordedProgramUri: Uri!)

Plays a given recorded TV program.

open Unit

Resumes playback.

open Unit

Seeks to a specified time position.

open Unit

Sets time shift mode.

open Unit

Sets playback rate using android.media.PlaybackParams.

open Unit
tune(inputId: String, channelUri: Uri!)

Tunes to a given channel.

open Unit
tune(inputId: String!, channelUri: Uri!, params: Bundle!)

Tunes to a given channel.

Protected methods
open Unit

Called by draw to draw the child views.

open Unit

This is called when the view is attached to a window.

open Unit

This is called when the view is detached from a window.

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

Called from layout when this view should assign a size and position to each of its children.

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

Measure the view and its content to determine the measured width and the measured height.

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

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

Inherited functions