public
class
TvRecordingClient
extends Object
java.lang.Object | |
↳ | android.media.tv.TvRecordingClient |
The public interface object used to interact with a specific TV input service for TV program recording.
Nested classes | |
---|---|
class |
TvRecordingClient.RecordingCallback
Callback used to receive various status updates on the
|
Public constructors | |
---|---|
TvRecordingClient(Context context, String tag, TvRecordingClient.RecordingCallback callback, Handler handler)
Creates a new TvRecordingClient object. |
Public methods | |
---|---|
void
|
release()
Releases the resources in the current recording session immediately. |
void
|
sendAppPrivateCommand(String action, Bundle data)
Sends a private command to the underlying TV input. |
void
|
startRecording(Uri programUri)
Starts TV program recording in the current recording session. |
void
|
stopRecording()
Stops TV program recording in the current recording session. |
void
|
tune(String inputId, Uri channelUri, Bundle params)
Tunes to a given channel for TV program recording. |
void
|
tune(String inputId, Uri channelUri)
Tunes to a given channel for TV program recording. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
TvRecordingClient (Context context, String tag, TvRecordingClient.RecordingCallback callback, Handler handler)
Creates a new TvRecordingClient object.
Parameters | |
---|---|
context |
Context :
The application context to create a TvRecordingClient with. |
tag |
String :
A short name for debugging purposes. |
callback |
TvRecordingClient.RecordingCallback :
The callback to receive recording status changes. |
handler |
Handler :
The handler to invoke the callback on.
|
void release ()
Releases the resources in the current recording session immediately. This may be called at any time, however if the session is already released, it does nothing.
void sendAppPrivateCommand (String action, Bundle data)
Sends a private command to the underlying TV input. This can be used to provide domain-specific features that are only known between certain clients and their TV inputs.
Parameters | |
---|---|
action |
String :
The name of the private command to send. 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 |
Bundle :
An optional bundle to send with the command.
|
void startRecording (Uri programUri)
Starts TV program recording in the current recording session. Recording is expected to start immediately when this method is called. If the current recording session has not yet tuned to any channel, this method throws an exception.
The application may supply the URI for a TV program for filling in program specific data
fields in the TvContract.RecordedPrograms
table.
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. In either case, the application must call
stopRecording()
to stop the recording.
The recording session will respond by calling onError(int)
if
the start request cannot be fulfilled.
Parameters | |
---|---|
programUri |
Uri :
The URI for the TV program to record, built by
buildProgramUri(long) . Can be null . |
Throws | |
---|---|
IllegalStateException |
If tune(String, Uri) request hasn't been handled yet.
|
void stopRecording ()
Stops TV program recording in the current recording session. Recording is expected to stop immediately when this method is called. If recording has not yet started in the current recording session, this method does nothing.
The recording session is expected to create a new data entry in the
TvContract.RecordedPrograms
table that describes the newly
recorded program and pass the URI to that entry through to
onRecordingStopped(Uri)
.
If the stop request cannot be fulfilled, the recording session will respond by calling
onError(int)
.
void tune (String inputId, Uri channelUri, Bundle params)
Tunes to a given channel for TV program recording. The first tune request will create a new recording session for the corresponding TV input and establish a connection between the application and the session. If recording has already started in the current recording session, this method throws an exception. This can be used to provide domain-specific features that are only known between certain client and their TV inputs.
The application may call this method before starting or after stopping recording, but not during recording.
The recording session will respond by calling
onTuned(Uri)
if the tune request was fulfilled, or
onError(int)
otherwise.
Parameters | |
---|---|
inputId |
String :
The ID of the TV input for the given channel. |
channelUri |
Uri :
The URI of a channel. |
params |
Bundle :
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. |
Throws | |
---|---|
IllegalStateException |
If recording is already started. |
void tune (String inputId, Uri channelUri)
Tunes to a given channel for TV program recording. The first tune request will create a new recording session for the corresponding TV input and establish a connection between the application and the session. If recording has already started in the current recording session, this method throws an exception.
The application may call this method before starting or after stopping recording, but not during recording.
The recording session will respond by calling
onTuned(Uri)
if the tune request was fulfilled, or
onError(int)
otherwise.
Parameters | |
---|---|
inputId |
String :
The ID of the TV input for the given channel. |
channelUri |
Uri :
The URI of a channel. |
Throws | |
---|---|
IllegalStateException |
If recording is already started. |