public abstract static class TvInputService.RecordingSession extends Object
Constructor and Description |
---|
RecordingSession(Context context)
Creates a new RecordingSession.
|
Modifier and Type | Method and Description |
---|---|
void |
notifyError(int error)
Informs the application that there is an error and this recording session is no longer
able to start or continue recording.
|
void |
notifyRecordingStopped(Uri recordedProgramUri)
Informs the application that this recording session has stopped recording and created a
new data entry in the
TvContract.RecordedPrograms table that describes the newly
recorded program. |
void |
notifySessionEvent(String eventType,
Bundle eventArgs)
Dispatches an event to the application using this recording session.
|
void |
notifyTuned(Uri channelUri)
Informs the application that this recording session has been tuned to the given channel
and is ready to start recording.
|
void |
onAppPrivateCommand(String action,
Bundle data)
Processes a private command sent from the application to the TV input.
|
abstract void |
onRelease()
Called when the application requests to release all the resources held by this recording
session.
|
abstract void |
onStartRecording(Uri programUri)
Called when the application requests to start TV program recording.
|
abstract void |
onStopRecording()
Called when the application requests to stop TV program recording.
|
abstract void |
onTune(Uri channelUri)
Called when the application requests to tune to a given channel for TV program recording.
|
void |
onTune(Uri channelUri,
Bundle params)
Called when the application requests to tune to a given channel for TV program recording.
|
public RecordingSession(Context context)
context
- The context of the applicationpublic void notifyTuned(Uri channelUri)
Upon receiving a call to onTune(Uri)
, the session is expected to tune to the
passed channel and call this method to indicate that it is now available for immediate
recording. When onStartRecording(Uri)
is called, recording must start with
minimal delay.
channelUri
- The URI of a channel.public void notifyRecordingStopped(Uri recordedProgramUri)
TvContract.RecordedPrograms
table that describes the newly
recorded program.
The recording session must call this method in response to onStopRecording()
.
The session may call it even before receiving a call to onStopRecording()
if a
partially recorded program is available when there is an error.
recordedProgramUri
- The URI of the newly recorded program.public void notifyError(int error)
onRelease()
is called.
The application may release the current session upon receiving the error code through
TvRecordingClient.RecordingCallback.onError(int)
. The session may call
notifyRecordingStopped(Uri)
if a partially recorded but still playable program
is available, before calling this method.
error
- The error code. Should be one of the followings.
public void notifySessionEvent(String eventType, Bundle eventArgs)
eventType
- The type of the event.eventArgs
- Optional arguments of the event.public abstract void onTune(Uri channelUri)
The application may call this method before starting or after stopping recording, but not during recording.
The session must call notifyTuned(Uri)
if the tune request was fulfilled, or
notifyError(int)
otherwise.
channelUri
- The URI of a channel.public void onTune(Uri channelUri, Bundle params)
The application may call this method before starting or after stopping recording, but
not during recording. The default implementation calls onTune(Uri)
.
The session must call notifyTuned(Uri)
if the tune request was fulfilled, or
notifyError(int)
otherwise.
channelUri
- The URI of a channel.params
- 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.public abstract void onStartRecording(Uri programUri)
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
TvRecordingClient.stopRecording()
to stop the recording.
The session must call notifyError(int)
if the start request cannot be
fulfilled.
programUri
- The URI for the TV program to record, built by
TvContract.buildProgramUri(long)
. Can be null
.public abstract void onStopRecording()
The session must create a new data entry in the
TvContract.RecordedPrograms
table that describes the newly
recorded program and call notifyRecordingStopped(Uri)
with the URI to that
entry.
If the stop request cannot be fulfilled, the session must call notifyError(int)
.
public abstract void onRelease()
public void onAppPrivateCommand(String action, Bundle data)
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.