Reputation: 73
I would like to implement video recording in Android TV, or at least a button that fires the recording event, I added the gradle dependency, but I could not find any RecordAction or RecordButton, only MultiAction, FastForwardAction etc.
What I would need is a button where the user clicks/presses and the current time of the current streamed media would be saved.
Upvotes: 2
Views: 455
Reputation: 13469
You may follow this documentation. To tell the system that your TV input service supports recording, set the android:canRecord
attribute in your service metadata XML file to true
:
<tv-input xmlns:android="http://schemas.android.com/apk/res/android"
android:canRecord="true"
android:setupActivity="com.example.sampletvinput.SampleTvInputSetupActivity" />
Alternatively, you can indicate recording support in your code using these steps:
onCreate()
method, create a new TvInputInfo
object using the TvInputInfo.Builder
class.TvInputInfo
object, call setCanRecord(true)
before calling build()
to indicate your service supports recording.TvInputInfo
object with the system by calling TvInputManager.updateTvInputInfo()
.Regarding button where the user clicks/presses, unfortunately I can't find any samples about it. According to the same reference above, the system will invoke the RecordingSession.onStartRecording()
callback when the system calls RecordingSession.onTune()
. Then your app must start recording immediately.
Upvotes: 1