Skip to content

Replacing non-streaming audio with live audio #1661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions __tests__/spelling-ignore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
- iso # lowercase needed in reference list
- RFC
- rfc
- MediaStream
- MediaStreamTrack
- enable-blink-features=WebCodecs
- MediaStreamInsertableStreams

# spell checker checks against strict casing & hence some repeated words here
- Autocomplete
Expand Down Expand Up @@ -220,10 +224,12 @@
- unicity
- Menuitem
- menuitems
- broadcasted
- namespaced-element
- Namespaced
- namespaceURI
- testability
- seekable

# Parts of Unicode
- 000A
Expand Down
2 changes: 1 addition & 1 deletion _rules/audio-as-media-alternative-afb423.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ acknowledgments:

## Applicability

This rule applies to every [non-streaming](#non-streaming-media-element) `audio` element that is:
This rule applies to every `audio` element that is:

- playing; or,
- has a "play button" that is [visible][] and [included in the accessibility tree][].
Expand Down
140 changes: 140 additions & 0 deletions _rules/audio-is-live-213x3x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
id: 213x3x
name: '`audio` element plays live content'
rule_type: atomic
description: |
This rule checks the content played by an `audio` element is live
accessibility_requirements:
input_aspects:
- DOM Tree
- CSS Styling
- Audio output
acknowledgments:
authors:
- Carlos Duarte
---

## Applicability

This rule applies to every `audio` element that is:

- playing; or,
- has a [play button][] that is [visible][] and [included in the accessibility tree][].

## Expectation

For each test target at least one of the following is true:

- the target element's [media resource][] is not [seekable][]; or
- after [seeking][seek] the end of the target element's [media resource][] the [current playback position][] is not the end of the target element's [media resource][].

## Assumptions

_No assumptions._

## Accessibility Support

There are no major accessibility support issues known for this rule.

## Background

- [Understanding SC 1.2.1:Audio-only and Video-only (Prerecorded)](https://www.w3.org/WAI/WCAG21/Understanding/audio-only-and-video-only-prerecorded)
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are many SC about pre recorded media. We should list all or none (or maybe you plan to add the rest when the atomic rule is added to the other composites)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I'll address this one after sorting out this rule.


## Test Cases

### Passed

#### Passed Example 1

This `audio` element plays a live media resource by streaming the audio from the device's microphone. The [media resource][] is a MediaStream which is not [seekable][].

Test instructions:

- Load the test case in a browser supporting the experimental MediaStreamTrack API (You can successfully test this example on Google Chrome with the flag --enable-blink-features=WebCodecs,MediaStreamInsertableStreams);
- Authorize the browser to access a microphone.

```html
<html lang="en">
<p>
This example requires a browser supporting the experimental MediaStreamTrack API. The browser must be authorized to
access a microphone. You can successfully test this example on Google Chrome with the flag
--enable-blink-features=WebCodecs,MediaStreamInsertableStreams
</p>

<p id="vLog"></p>
<audio controls autoplay></audio>

<script>
const log = document.querySelector('#vLog')

document.addEventListener(
'DOMContentLoaded',
function(event) {
if (typeof MediaStreamTrackProcessor === 'undefined' || typeof MediaStreamTrackGenerator === 'undefined') {
log.innerHTML =
'Your browser does not support the experimental MediaStreamTrack API. ' +
'Please launch with the --enable-blink-features=WebCodecs,MediaStreamInsertableStreams flag'
return
}

const constraints = {
audio: true,
video: false,
}

navigator.mediaDevices
.getUserMedia(constraints)
.then(function(mediaStream) {
document.querySelector('audio').srcObject = mediaStream
})
.catch(function(err) {
log.innerHTML += err.name + ': ' + err.message
})
},
false
)
</script>
</html>
```

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am assuming we are expanding these passed examples with real streaming audios/videos of broadcasting orgs, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was the main idea.

As was also mentioned in TPAC, we might want to explore the possibility of W3C hosting a streaming server where we could serve the examples (we would just loop one of the videos we already use).

### Failed

#### Failed Example 1

This `audio` element plays a recorded media resource.

```html
<html lang="en">
<audio src="/test-assets/moon-audio/moon-speech.mp3" controls></audio>
</html>
```

### Inapplicable

#### Inapplicable Example 1

This `audio` element's controls are not [visible][] on the page.

```html
<html lang="en">
<audio src="/test-assets/moon-audio/moon-speech.mp3" controls style="display: none;"></audio>
</html>
```

#### Inapplicable Example 2

This `audio` element does not have controls.

```html
<html lang="en">
<audio src="/test-assets/moon-audio/moon-speech.mp3"></audio>
</html>
```

[current playback position]: https://html.spec.whatwg.org/multipage/media.html#current-playback-position
[included in the accessibility tree]: #included-in-the-accessibility-tree 'Definition of included in the accessibility tree'
[media resource]: https://html.spec.whatwg.org/multipage/media.html#media-resource
[play button]: #play-button
[seek]: https://html.spec.whatwg.org/multipage/media.html#dom-media-seek
[seekable]: https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable
[visible]: #visible 'Definition of visible'
4 changes: 3 additions & 1 deletion _rules/audio-text-alternative-e7aa44.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ accessibility_requirements:
input_rules:
- 2eb176
- afb423
- 213x3x
acknowledgments:
authors:
- Brian Bors
Expand All @@ -30,7 +31,7 @@ acknowledgments:

## Applicability

This rule applies to any [non-streaming](#non-streaming-media-element) `audio` element that is:
This rule applies to any `audio` element that is:

- playing; or,
- has a "play button" that is [visible][] and [included in the accessibility tree](#included-in-the-accessibility-tree).
Expand All @@ -43,6 +44,7 @@ For each test target, the [outcome](#outcome) of at least one of the following r

- [`Audio` Element Content Has Transcript](https://act-rules.github.io/rules/2eb176)
- [`Audio` Element Content Is Media Alternative For Text](https://act-rules.github.io/rules/afb423)
- [`Audio` Element Plays Live Content](https://act-rules.github.io/rules/213x3x)

## Assumptions

Expand Down
2 changes: 1 addition & 1 deletion _rules/audio-transcript-2eb176.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ acknowledgments:

## Applicability

This rule applies to every [non-streaming](#non-streaming-media-element) `audio` element that is:
This rule applies to every `audio` element that is:

- playing; or,
- has a "play button" that is [visible][] and [included in the accessibility tree][].
Expand Down
12 changes: 12 additions & 0 deletions pages/glossary/play-button.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Play button
key: play-button
unambiguous: true
objective: false
---

A play button is an [instrument][] that when [activated][] plays a [media resource][].

[activated]: https://html.spec.whatwg.org/#activation
[instrument]: #instrument-to-achieve-an-objective
[media resource]: https://html.spec.whatwg.org/multipage/media.html#media-resource