Detect changes in power status of a TV connected to an Android device via HDMI

I'm building an Android media player application that I intend to use to play media (videos, pictures, etc.) on a TV while connected via an HDMI cable.

I want to have the media player app pause when the TV's power status is OFF and want it to play when the TV is turned ON.

How do I detect the TV's power status within my Android application when my Android device is connected to the TV via HDMI?

Both the TV and the Android device have support for HDMI-CEC. The device in question is an ODROID C2. I've seen this functionality on the KODI Android application which has a feature to pause the video when the HDMI-CEC status is OFF, I'm looking to implement this within my app as well.

Any help is appreciated. Thanks in advance!

EDIT: Progress below

I tried reading the status of the HDMI connection from within this file /sys/devices/virtual/switch/hdmi/state . However, this file holds int 1 no matter whether the power status of the connected screen / TV is ON or OFF.

2nd Progress update

I'm still working on this. Will not give up, and once I'm done I will surely post the answer here.

链接地址: http://www.djcxy.com/p/82562.html

上一篇: Clojure类型提示语法

下一篇: 通过HDMI检测连接到Android设备的电视电源状态的变化