Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. BaseAudioContext
  4. statechange

BaseAudioContext: statechange event

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨April 2021⁩.

Astatechange event is fired at aBaseAudioContext object when itsstate member changes.

Syntax

Use the event name in methods likeaddEventListener(), or set an event handler property.

js
addEventListener("statechange", (event) => { })onstatechange = (event) => { }

Event type

A genericEvent.

Examples

The following snippet is taken from ourAudioContext states demo (see it running live.) Theonstatechange handler is used to log the currentstate to the console every time it changes.

js
audioCtx.onstatechange = () => {  console.log(audioCtx.state);};

Specifications

Specification
Web Audio API
# dom-baseaudiocontext-onstatechange

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp