Skip to content

Fix MediaSession action handler example#44728

Draft
coyaSONG wants to merge 1 commit into
mdn:mainfrom
coyaSONG:fix/mediasession-action-example
Draft

Fix MediaSession action handler example#44728
coyaSONG wants to merge 1 commit into
mdn:mainfrom
coyaSONG:fix/mediasession-action-example

Conversation

@coyaSONG

Copy link
Copy Markdown
Contributor

Description

Clarifies the MediaSession play and pause action-handler example by selecting the page's <audio> element and removing calls to undefined demo-only status helpers. It also omits the unused catch binding in the same example.

Motivation

The current sample references audioEl, updateStatus, allMeta, and index without defining them, which makes the example difficult to understand or reuse. The updated example is focused on the documented media-session behavior and defines every value it uses.

Additional details

Validation completed:

  • Prettier, Markdownlint, and CSpell on the changed page
  • Repository test suite (5/5)
  • JavaScript syntax and play/pause handler behavior checks
  • Rari single-page build with no reported issues
  • Repository pre-commit URL, cross-reference, front-matter, Prettier, and Markdownlint checks

Related issues and pull requests

Fixes #41250

@github-actions github-actions Bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview URLs (1 page)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MediaSession code samples inexplicable

2 participants