Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 40 additions & 14 deletions _rules/audio-or-video-avoids-automatically-playing-audio-80f0bf.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ This rule applies to any `audio` or `video` element for which all the following
- **autoplay**: the element has an `autoplay` [attribute value][] of `true`; and
- **not muted**: the element has a `muted` [attribute value][] of `false`; and
- **not paused**: the element has a `paused` [attribute value][] of `false`; and
- **duration**: the element has a [media resource][] lasting more than 3 seconds and that contains audio.
- **play time**: the element has a [media resource][] that contains audio and that stops after no more than 3 seconds. This can be changed by authors, for example using a [temporal media fragment URI](https://www.w3.org/TR/media-frags/#naming-time) (`#t`) in the source URI.

## Expectation

Expand Down Expand Up @@ -101,18 +101,7 @@ This `audio` element has an [instrument][] to pause, stop, or turn the audio vol

#### Passed Example 2

This `video` element does not play for longer than 3 seconds.

```html
<video autoplay>
<source src="/test-assets/rabbit-video/video.mp4#t=8,10" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm#t=8,10" type="video/webm" />
</video>
```

#### Passed Example 3

This `video` element autoplays and has an [instrument][] to pause, stop, or turn the audio volume off.
This `video` element is longer than 3 seconds, autoplays, and has an [instrument][] to pause, stop, or turn the audio volume off.

```html
<head>
Expand Down Expand Up @@ -192,6 +181,43 @@ This `video` element has no audio output.

#### Inapplicable Example 3

This `video` element does not play for longer than 3 seconds.

```html
<video autoplay>
<source src="/test-assets/rabbit-video/video.mp4#t=8,10" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm#t=8,10" type="video/webm" />
Comment on lines +184 to +189
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one's actually kind of tricky. The media resource has a duration of 13 seconds, but the video has a play time of 2 seconds. I think we'll need to update the applicability.

Something like:

- **play time**: the element has a [media resource][] that contains audio and that stops no more than 3 

**Note**: For most videos the start time is 0, and the stop time is the end of the video. In HTML the `t` parameter allows content authors to set the start and stop time of a video.

@Jym77 WDYT?

Copy link
Collaborator

@Jym77 Jym77 Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point. Maybe phrasing the second sentence a bit more generically and with a link to specs:

This can be changed by authors, for example using a [temporal media fragment URI](https://www.w3.org/TR/media-frags/#naming-time) (`#t`) in the source URI.

</video>
```

#### Inapplicable Example 4

This `video` element autoplays but is paused.

```html
<video id="paused" autoplay>
<source src="/test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm" type="video/webm" />
</video>

<script>
document.getElementById('paused').pause();
</script>
```

#### Inapplicable Example 5

This `video` element does not play automatically.

```html
<video>
<source src="/test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm" type="video/webm" />
</video>
```

#### Inapplicable Example 6

This `audio` element does not play automatically.

```html
Expand All @@ -202,4 +228,4 @@ This `audio` element does not play automatically.
[instrument]: #instrument-to-achieve-an-objective 'Definition of Instrument to Achieve an Objective'
[media resource]: https://html.spec.whatwg.org/multipage/media.html#media-resource 'HTML Specification of Media Resource'
[sc142]: https://www.w3.org/TR/WCAG22/#audio-control 'Success Criterion 1.4.2 Audio Control'
[web page]: #web-page-html 'Definition of HTML web page'
[web page]: #web-page-html 'Definition of HTML web page'