Added in API level 24

RecordingSession


abstract class RecordingSession
kotlin.Any
   ↳ android.media.tv.TvInputService.RecordingSession

Base class for derived classes to implement to provide a TV input recording session.

Summary

Public constructors

Creates a new RecordingSession.

Public methods
open Unit
notifyError(error: Int)

Informs the application that there is an error and this recording session is no longer able to start or continue recording.

open Unit
notifyRecordingStopped(recordedProgramUri: Uri!)

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.

open Unit
notifyTuned(channelUri: Uri!)

Informs the application that this recording session has been tuned to the given channel and is ready to start recording.

open Unit
onAppPrivateCommand(action: String, data: Bundle!)

Processes a private command sent from the application to the TV input.

open Unit

Called when the application requests to pause TV program recording.

abstract Unit

Called when the application requests to release all the resources held by this recording session.

open Unit

Called when the application requests to resume TV program recording.

abstract Unit
onStartRecording(programUri: Uri?)

Called when the application requests to start TV program recording.

open Unit
onStartRecording(programUri: Uri?, params: Bundle)

Called when the application requests to start TV program recording.

abstract Unit

Called when the application requests to stop TV program recording.

abstract Unit
onTune(channelUri: Uri!)

Called when the application requests to tune to a given channel for TV program recording.

open Unit
onTune(channelUri: Uri!, params: Bundle!)

Called when the application requests to tune to a given channel for TV program recording.

Public constructors

RecordingSession

Added in API level 24
RecordingSession(context: Context!)

Creates a new RecordingSession.

Parameters
context Context!: The context of the application

Public methods

notifyError

Added in API level 24
open fun notifyError(error: Int): Unit

Informs the application that there is an error and this recording session is no longer able to start or continue recording. It may be called at any time after the recording session is created until 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(android.net.Uri) if a partially recorded but still playable program is available, before calling this method.

Parameters
error Int: The error code. Should be one of the followings. Value is android.media.tv.TvInputManager#RECORDING_ERROR_UNKNOWN, android.media.tv.TvInputManager#RECORDING_ERROR_INSUFFICIENT_SPACE, or android.media.tv.TvInputManager#RECORDING_ERROR_RESOURCE_BUSY

notifyRecordingStopped

Added in API level 24
open fun notifyRecordingStopped(recordedProgramUri: Uri!): Unit

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.

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.

Parameters
recordedProgramUri Uri!: The URI of the newly recorded program.

notifyTuned

Added in API level 24
open fun notifyTuned(channelUri: Uri!): Unit

Informs the application that this recording session has been tuned to the given channel and is ready to start recording.

Upon receiving a call to onTune(android.net.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(android.net.Uri) is called, recording must start with minimal delay.

Parameters
channelUri Uri!: The URI of a channel.

onAppPrivateCommand

Added in API level 24
open fun onAppPrivateCommand(
    action: String,
    data: Bundle!
): Unit

Processes a private command sent from the application to the TV input. This can be used to provide domain-specific features that are only known between certain TV inputs and their clients.

Parameters
action String: 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. This value cannot be null.
data Bundle!: Any data to include with the command.

onPauseRecording

Added in API level 31
open fun onPauseRecording(params: Bundle): Unit

Called when the application requests to pause TV program recording. Recording must pause immediately when this method is called. If the pause request cannot be fulfilled, the session must call notifyError(int).

Parameters
params Bundle: Domain-specific data for recording request. This value cannot be null.

onRelease

Added in API level 24
abstract fun onRelease(): Unit

Called when the application requests to release all the resources held by this recording session.

onResumeRecording

Added in API level 31
open fun onResumeRecording(params: Bundle): Unit

Called when the application requests to resume TV program recording. Recording must resume immediately when this method is called. If the resume request cannot be fulfilled, the session must call notifyError(int).

Parameters
params Bundle: Domain-specific data for recording request. This value cannot be null.

onStartRecording

Added in API level 24
abstract fun onStartRecording(programUri: Uri?): Unit

Called when the application requests to start TV program recording. Recording must start immediately when this method is called.

The application may supply the URI for a TV program for filling in program specific data fields in the android.media.tv.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.

Parameters
programUri Uri?: The URI for the TV program to record, built by TvContract#buildProgramUri(long). Can be null.

onStartRecording

Added in API level 30
open fun onStartRecording(
    programUri: Uri?,
    params: Bundle
): Unit

Called when the application requests to start TV program recording. Recording must start immediately when this method is called.

The application may supply the URI for a TV program for filling in program specific data fields in the android.media.tv.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.

Parameters
programUri Uri?: The URI for the TV program to record, built by TvContract#buildProgramUri(long). Can be null.
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. This value cannot be null.

onStopRecording

Added in API level 24
abstract fun onStopRecording(): Unit

Called when the application requests to stop TV program recording. Recording must stop immediately when this method is called.

The session must create a new data entry in the android.media.tv.TvContract.RecordedPrograms table that describes the newly recorded program and call notifyRecordingStopped(android.net.Uri) with the URI to that entry. If the stop request cannot be fulfilled, the session must call notifyError(int).

onTune

Added in API level 24
abstract fun onTune(channelUri: Uri!): Unit

Called when the application requests to tune to a given channel for TV program recording.

The application may call this method before starting or after stopping recording, but not during recording.

The session must call notifyTuned(android.net.Uri) if the tune request was fulfilled, or notifyError(int) otherwise.

Parameters
channelUri Uri!: The URI of a channel.

onTune

Added in API level 24
open fun onTune(
    channelUri: Uri!,
    params: Bundle!
): Unit

Called when the application requests to tune to a given channel for TV program recording. Override this method in order to handle domain-specific features that are only known between certain TV inputs and their clients.

The application may call this method before starting or after stopping recording, but not during recording. The default implementation calls onTune(android.net.Uri).

The session must call notifyTuned(android.net.Uri) if the tune request was fulfilled, or notifyError(int) otherwise.

Parameters
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.