@dioramajs/audio/graph
One audio graph per page: one AudioContext and one source per media element.
import { audio, check, local } from '@dioramajs/audio/graph'Functions
audio | The page's context, made on first use; undefined without Web Audio. |
check | Whether the element's sound survives the graph. A URL of the page's origin is asked for once: in `same-origin` mode any redirect to another origin fails, just as it taints the element's own request. A server without HEAD gets a GET for the first byte. |
local | Whether Web Audio can read the element without muting it, as far as the page can tell without a request: true, false, or undefined for a URL of the page's own origin, which a redirect may take elsewhere, and for an element without a source yet. |
routed | The element's sound already goes through the graph. |
running | Resolves true once the context runs, false if the signal aborts first. A suspended context would route a connected element to silence, so nothing connects before it runs. |
source | The element's source. The first call takes the element's sound into the graph for good (the browser allows one source per element), so the source goes to the output at once and stays connected; analysers come and go beside it. |
sourceOf | The URL the element plays: its current source, else `src`, else its first `<source>`. |
wake | Asks a suspended context to run again, as a new play may allow. |