Skip to content

Commit

Permalink
HTMLMediaElement waitingforkey event docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee committed Nov 18, 2024
1 parent fbc04f8 commit 3d09048
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ browser-compat: api.HTMLMediaElement.encrypted_event

{{APIRef("Encrypted Media Extensions")}}

The `encrypted` event is fired when initialization data is found in the media, indicating that it is encrypted.
The `encrypted` event is fired when initialization data is found in the media that indicates it is encrypted.

This event is not cancelable and does not bubble.

Expand Down
4 changes: 3 additions & 1 deletion files/en-us/web/api/htmlmediaelement/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Listen to these events using {{domxref("EventTarget.addEventListener", "addEvent
- {{domxref("HTMLMediaElement.emptied_event", 'emptied')}}
- : Fired when the media has become empty; for example, when the media has already been loaded (or partially loaded), and the {{domxref("HTMLMediaElement.load()")}} method is called to reload it.
- {{domxref("HTMLMediaElement.encrypted_event", 'encrypted')}}
- : Fired when initialization data is found in the media, indicating that it is encrypted.
- : Fired when initialization data is found in the media that indicates the media is encrypted.
- {{domxref("HTMLMediaElement.ended_event", 'ended')}}
- : Fired when playback stops when end of the media (\<audio> or \<video>) is reached or because no further data is available.
- {{domxref("HTMLMediaElement.error_event", 'error')}}
Expand Down Expand Up @@ -190,6 +190,8 @@ Listen to these events using {{domxref("EventTarget.addEventListener", "addEvent
- : Fired when the volume has changed.
- {{domxref("HTMLMediaElement.waiting_event", 'waiting')}}
- : Fired when playback has stopped because of a temporary lack of data.
- {{domxref("HTMLMediaElement.waitingforkey_event", 'waitingforkey')}}
- : Fired when playback is first blocked while waiting for a key.

## Specifications

Expand Down
43 changes: 43 additions & 0 deletions files/en-us/web/api/htmlmediaelement/waitingforkey_event/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: "HTMLMediaElement: waitingforkey event"
short-title: waitingforkey
slug: Web/API/HTMLMediaElement/waitingforkey_event
page-type: web-api-event
browser-compat: api.HTMLMediaElement.waitingforkey_event
---

{{APIRef("Encrypted Media Extensions")}}

The `waitingforkey` event is fired at a media element when it is first unable to play because it needs a key to decode the following data, and playback is stopped.

If the video frame and/or audio data for the current playback position have been decoded, {{domxref("HTMLMediaElement.readyState", "readyState")}} is set to [`HAVE_CURRENT_DATA`](/en-US/docs/Web/API/HTMLMediaElement/readyState#htmlmediaelement.have_current_data).
Otherwise, including if the data was previously available but isn't anymore, the `readyState` is set to [`HAVE_METADATA`](/en-US/docs/Web/API/HTMLMediaElement/readyState#htmlmediaelement.have_metadata).

## Syntax

Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.

```js
addEventListener("waitingforkey", (event) => {});

onwaitingforkey = (event) => {};
```

## Event type

An {{domxref("Event")}}.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("HTMLAudioElement")}}
- {{domxref("HTMLVideoElement")}}
- {{HTMLElement("audio")}}
- {{HTMLElement("video")}}

0 comments on commit 3d09048

Please sign in to comment.