Manage TV user interaction

In the live TV experience the user changes channels and is presented with
channel and program information briefly before the information disappears. Other types of information,
such as messages ("DO NOT ATTEMPT AT HOME"), subtitles, or ads may need to persist. As with any TV
app, such information should not interfere with the program content playing on the screen.

Figure 1. An overlay message in a live TV app.

Also consider whether certain program content should be presented, given the
content's rating and parental control settings, and how your app behaves and informs the user when
content is blocked or unavailable. This lesson describes how to develop your TV input's user
experience for these considerations.

Use an overlay

Use an overlay to display subtitles, messages, ads or MHEG-5 data broadcasts. By default, the
overlay is disabled. You can enable it when you create the session by calling
TvInputService.Session.setOverlayViewEnabled(true),
as in the following example:

Control content

When the user selects a channel, your TV input handles the onTune() callback in the TvInputService.Session object. The system TV
app's parental controls determine what content displays, given the content rating.
The following sections describe how to manage channel and program selection using the
TvInputService.Sessionnotify methods that
communicate with the system TV app.

The system TV app provides an interface for the user to select a specific track if more than one
track is available for a given track type; for example, subtitles in different languages. Your TV
input responds to the
onSelectTrack()
call from the system TV app by calling
notifyTrackSelected()
, as shown in the following example. Note that when null
is passed as the track ID, this deselects the track.