I'm currently working on an Android Remote Control application that can connect and control Android TV. I have successfully paired the devices and can now send different keycode commands to control the TV box.
The next feature that I want to implement is about sending voice input to the TV. To open voice input, I can either use KEYCODE_SEARCH(84), manually clicking on Google Assistant, or manually clicking on the Mic icon like in YouTube app.
But what's next?
After a few days researching, there aren't many documents about this and the existing public projects are all using Remote Control V1. As far as I know, I need to do something with RemoteVoicePayload, RemoteVoiceBegin, and RemoteVoiceEnd.
Have you worked on this before? What are the procedures for this? How can I simultaneously speak to the phone and the text get updated on the TV?
Thank you!
(This is my first post on this platform so sorry if I did something not correct)
I.m currently working on it too. As far as I know, after record, you will need to convert file to byteArray, then it will look like (I assume that you have connected TV successful)
fun createVoiceCommandPayload(value: ByteArray): ByteArray {
val remoteMessage: RemoteMessage = RemoteMessage.newBuilder()
.setVoicePayload(
ByteString.copyFrom(value)
).build()
return addLengthAndCreate(remoteMessage.toByteArray())
}
then using outputsteam to write it on, hope it help