---
title: cec
slug: develop/cec
docTags: 
createdAt: 2025-03-11T07:07:19.526Z
---

The *cec* object lets you send messages over CEC (Consumer Electronics Control).

**cec IDL**

```text
interface ReceiveEvent {
    attribute String type;
    attribute Array<byte> data;
};

callback ReceiveEventCallback = void (ReceiveEvent event);

interface Cec {
    Promise<void> send(Array<byte> data);
    void addEventListener(String type, ReceiveEventCallback callback);
    void removeEventListener(String type, ReceiveEventCallback callback);
};
```

## Object Creation

To create a *cec* object, load the *@brightsign/cec* module using the `require()` method. 

```javascript
const CecClass = require('@brightsign/cec');
const cec = new CecClass();
```

Set the specific HDMI port for players with more than one output as follows:

```javascript
const CecClass = require("@brightsign/cec");
const cec = new CecClass("HDMI-2"); //Modify this to be 'HDMI-1', 'HDMI-2', 'HDMI-3', and 'HDMI-4' as needed
```

## Cec

### Event

- `ReceiveEvent`:  The CEC reception path is implemented as a receive event. The receive message has two generic fields:
  - `type`:  The event type "receive"
  - `data`:  Array CEC frame

### Method

### send()

```javascript
    Promise<void> send(Array<byte> data)
```

Sends messages over *cec.*

- `data`<font color="#6B21A8"> Array&lt;byte&gt;</font>: The CEC frame

### port\_name ()

```javascript
    Promise<void>
```

The parameters for this optional argument are:

- `default`: The default output for the platform, normally `HDMI-1`
- `HDMI-X`: X is a number from 1 up to the number of HDM&#x49;**®** outputs on the platform
- `eARC`: The default for the AU335 

:::hint{type="info"}
As of BrightSignOS 8.2.55, the CEC implementation for AU series 5 products will reply to these messages with the correct data, without involving the script:

- CEC\_MSG\_GET\_CEC\_VERSION
- CEC\_MSG\_ABORT
- CEC\_MSG\_GIVE\_DEVICE\_POWER\_STATUS
- CEC\_MSG\_GIVE\_OSD\_NAME
- CEC\_MSG\_GIVE\_DEVICE\_VENDOR\_ID
- CEC\_MSG\_GIVE\_FEATURES
- CEC\_MSG\_GIVE\_PHYSICAL\_ADDR
- CEC\_MSG\_USER\_CONTROL\_PRESSED
- CEC\_MSG\_USER\_CONTROL\_RELEASED
- CEC\_MSG\_REPORT\_PHYSICAL\_ADDR
:::

## Example

See this [BrightScript example in GitHub](https://github.com/brightsign/dev-cookbook/tree/main/examples/cec-interface/javascript).&#x20;

See [BSCECTransmitter](docId\:mA-PNB9N4I6NIn_IXnr0R) for an example that turns a display on and off.

