Reputation: 13
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 the 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 gets updated on the TV?
Upvotes: 1
Views: 1031
Reputation: 56
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
Upvotes: 1
Reputation: 1
I think you need to do configuration and then send the voice, something like this:
RemoteProto.RemoteMessage.Builder newBuilder = RemoteProto.RemoteMessage.newBuilder(); newBuilder.setVoiceEnd(RemoteProto.VoiceEnd.newBuilder().setSessionId(-1)).build();
Upvotes: -2