I am developing an Android TV application and I want to access the live video coming from an external set-top box connected to the TV's HDMI port.
My setup is:
Set-top box → HDMI cable → Xiaomi Android TV (HDMI 2) → My Android application
The set-top box does not run my application. My application runs directly on the Android TV.
My requirement is to get the HDMI input video into my Android application so that I can display it and potentially process the video.
Device information:
Xiaomi A Pro QLED 32"
Model: MiTV-AXFU0
Codename: arctictale
Android 14
Amlogic SoC
Build: UKG3.241124.001
Firmware: V816.0.26.5.27.1.UXFAATV
I have confirmed that the TV exposes its HDMI inputs through the Android TV Input Framework.
For example, HDMI 2 appears as:
com.droidlogic.tvinput/.services.Hdmi2InputService/HW6
I first tried using TvView with the HDMI passthrough input. TvView.tune() succeeds and the Surface becomes valid, but the Surface remains black and my application does not receive the HDMI video.
I then investigated TvInputManager and found this API:
TvInputManager.acquireTvInputHardware()
I tried calling it from my application, but it currently fails with the following exception:
java.lang.reflect.InvocationTargetException
Caused by:
java.lang.NullPointerException
at com.android.internal.util.Preconditions.checkNotNull(Preconditions.java:147)
at android.media.tv.TvInputManager.acquireTvInputHardware(TvInputManager.java:2472)
I understand that acquireTvInputHardware() may be restricted to system/privileged applications, so I am not sure whether this is the correct API for my use case.
I am trying to understand what realistic options exist for getting the physical HDMI input into an application running on the same Android TV.
I have considered the following possibilities:
Android TV Input Framework / TvView
TvInputManager / TvInputHardware
A vendor-specific Amlogic HDMI-RX API
Amlogic/DroidLogic framework APIs
Native Amlogic libraries
Linux device nodes such as /dev/hdmirx0
V4L2 or another Linux video capture interface
Making the application a system/privileged application
Root access
A custom system image or firmware
Accessing or communicating with the existing DroidLogic HDMI input service
Any other vendor-specific mechanism
I am willing to use a system/privileged application or root access if that is technically required.
I am not looking for a USB HDMI capture device.
I specifically want to use the TV's built-in HDMI receiver:
External HDMI source → TV HDMI input → Android application
My main question is:
Is there any way to get the live video frames from a physical HDMI-IN port into a custom Android application running on the same Android TV?
If this is possible on Amlogic/DroidLogic TVs, I would appreciate information about the relevant API, service, native library, device node, permission, system-app requirement, or example implementation.
If it is not possible, I would also like to understand why. For example, is the HDMI video completely handled inside the vendor TV-input/video pipeline and never exposed to applications?
I am mainly looking for the correct architecture or API, rather than specifically asking how to fix the NullPointerException above.