---
title: HTMLMediaElement.onencrypted
slug: Web/API/HTMLMediaElement/onencrypted
browser-compat: api.HTMLMediaElement.onencrypted
---
{{APIRef("Encrypted Media Extensions")}}{{ SeeCompatTable() }}

The **`onencrypted`** property of the
{{domxref("HTMLMediaElement")}} is an event handler, fired whenever an
{{Event("encrypted")}} event occurs, denoting the media is encrypted.

This interface inherits from the {{domxref("ExtendableEvent")}} interface.

{{InheritanceDiagram(700, 60, 20)}}

## Syntax

```js
HTMLMediaElement.onencrypted = function(encrypted) { ... }
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
