public static final class TvInputManager.Session extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
TvInputManager.Session.FinishedInputEventCallback
Callback that is invoked when an input event that was dispatched to this session has been
finished.
|
Modifier and Type | Method and Description |
---|---|
int |
dispatchInputEvent(InputEvent event,
Object token,
TvInputManager.Session.FinishedInputEventCallback callback,
Handler handler)
Dispatches an input event to this session.
|
void |
dispatchSurfaceChanged(int format,
int width,
int height)
Notifies of any structural changes (format or size) of the surface passed in
setSurface(android.view.Surface) . |
String |
getSelectedTrack(int type)
Returns the selected track for a given type.
|
List<TvTrackInfo> |
getTracks(int type)
Returns the list of tracks for a given type.
|
void |
release()
Releases this session.
|
void |
selectTrack(int type,
String trackId)
Selects a track.
|
void |
sendAppPrivateCommand(String action,
Bundle data)
Calls
TvInputService.Session.appPrivateCommand() on the current TvView. |
void |
setCaptionEnabled(boolean enabled)
Enables or disables the caption for this session.
|
void |
setStreamVolume(float volume)
Sets the relative stream volume of this session to handle a change of audio focus.
|
void |
setSurface(Surface surface)
Sets the
Surface for this session. |
void |
tune(Uri channelUri)
Tunes to a given channel.
|
void |
tune(Uri channelUri,
Bundle params)
Tunes to a given channel.
|
public void release()
public void setSurface(Surface surface)
Surface
for this session.surface
- A Surface
used to render video.public void dispatchSurfaceChanged(int format, int width, int height)
setSurface(android.view.Surface)
.format
- The new PixelFormat of the surface.width
- The new width of the surface.height
- The new height of the surface.public void setStreamVolume(float volume)
volume
- A volume value between 0.0f to 1.0f.IllegalArgumentException
- if the volume value is out of range.public void tune(Uri channelUri)
channelUri
- The URI of a channel.public void tune(Uri channelUri, Bundle params)
channelUri
- The URI of a channel.params
- A set of extra parameters which might be handled with this tune event.public void setCaptionEnabled(boolean enabled)
enabled
- true
to enable, false
to disable.public void selectTrack(int type, String trackId)
type
- The type of the track to select. The type can be
TvTrackInfo.TYPE_AUDIO
, TvTrackInfo.TYPE_VIDEO
or
TvTrackInfo.TYPE_SUBTITLE
.trackId
- The ID of the track to select. When null
, the currently selected
track of the given type will be unselected.getTracks(int)
public List<TvTrackInfo> getTracks(int type)
null
if the information is
not available.type
- The type of the tracks. The type can be TvTrackInfo.TYPE_AUDIO
,
TvTrackInfo.TYPE_VIDEO
or TvTrackInfo.TYPE_SUBTITLE
.public String getSelectedTrack(int type)
null
if the information is
not available or any of the tracks for the given type is not selected.selectTrack(int, java.lang.String)
public void sendAppPrivateCommand(String action, Bundle data)
TvInputService.Session.appPrivateCommand()
on the current TvView.action
- Name of the command to be performed. This must be a scoped name,
i.e. prefixed with a package name you own, so that different developers will
not create conflicting commands.data
- Any data to include with the command.public int dispatchInputEvent(InputEvent event, Object token, TvInputManager.Session.FinishedInputEventCallback callback, Handler handler)
event
- An InputEvent
to dispatch. Cannot be null
.token
- A token used to identify the input event later in the callback.callback
- A callback used to receive the dispatch result. Cannot be null
.handler
- A Handler
that the dispatch result will be delivered to. Cannot be
null
.DISPATCH_HANDLED
if the event was handled. Returns
DISPATCH_NOT_HANDLED
if the event was not handled. Returns
DISPATCH_IN_PROGRESS
if the event is in progress and the callback will
be invoked later.