useCec
Returns a reactive accessor for the device's HDMI-CEC active source status
import { useCec } from "@roku-sdk/runtime/cec";const useCec: () => { cecStatus: Accessor<CecInfo | null> } & Record<string, never>Description
Returns a reactive accessor for the device's HDMI-CEC active source status.
CEC (Consumer Electronics Control) lets HDMI devices signal one another. cecStatus is null until the runtime reports the first status, then holds the latest CecInfo: whether the device is the active source on the HDMI input and, on firmware that reports it, the active source state. Unrecognized state values from firmware are reported as CecActiveSourceState.Unknown. If the CEC interface fails to initialize, the hook logs an error and cecStatus stays null.
Example
const { cecStatus } = useCec();
<label text={cecStatus()?.active ? "Active source" : "Not active"} />;Updated about 3 hours ago
What’s Next
Did this page help you?