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

The **`onwaitingforkey`** property of
the {{domxref("HTMLMediaElement")}} is an event handler, fired when a
{{Event("waitingforkey")}} event  occurs, when playback is blocked while waiting
for an encryption key.

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

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

## Syntax

```js
HTMLMediaElement.onwaitingforkey = function(waitingforkey) { ... }
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
