-
Notifications
You must be signed in to change notification settings - Fork 166
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
TAG Issue: Layering considerations #257
Comments
@jernoble would you be able to use your https://github.com/jernoble/Sound repo to answer @slightlyoff's original set of questions above? Especially the last set? |
Sort of. Jer's sound.js repo just calls decodeAudioData() for all files - so it's not going to stream, it will need a complete file before it will start. We'd need to implement codecs (or expand the decoding API in Web Audio) to make it complete. |
What we need to respond to this:
|
Next step: write a response to the TAG issues, including this one. |
TPAC: this is a big chunk that we should make top of the list for post-V1 action, and take a fresh look with the TAG at a cross-WG discussion. |
One issue I've run into recently: it's impossible to accurately schedule playback (start/pause) of an HTMLMediaElement connected to an audioContext. This means there is no ability (as far as I know) to schedule accurate playback of either a large audio file (requiring streaming) or an EME-protected file. Is accurate scheduled playback also addressed by this issue? Or a separate concern? |
It's separate. This is about speccing the For accurate scheduling of long media element, I don't think there is a perfect, built-in way to do this at the moment. Authors have had good experience of using stiched Being able to pipe EME-protected content in a Web Audio API using a |
Ok, sorry for causing noise on this issue, and thank you for your thoughtful response! To answer your question: accurate means sample accurate (10ms of schedule jitter is perceptible in applications like beat-synced triggering of I'll raise a separate issue with more details. |
It's been decided to do the decoding part of things in a different spec, because the Web Audio API really is about processing. The Web Audio API can do everything that is needed on the playback side of the HTMLMediaElement. |
The following point was raised by the W3C TAG as part of their review of the Web Audio API. In it a number of issues are raised, which we can split into separate issues if required. For now let's capture our response in this issue.
Layering Considerations
Web Audio is very low-level and this is a virtue. By describing a graph that operates in terms of samples of bytes, it enables developers to tightly control the behavior of processing and ensure low-latency delivery of results.
Today's Web Audio spec is an island: connected to its surroundings via loose ties, not integrated into the fabric of the platform as the natural basis and explanation of all audio processing -- despite being incredibly fit for that purpose.
Perhaps the most striking example of this comes from the presence in the platform of both Web Audio and the
<audio>
element. Given that the<audio>
element is incredibly high-level, providing automation for loading, decoding, playback and UI to control these processes, it would appear that Web Audio lives at an all-together lower place in the conceptual stack. A natural consequence of this might be to re-interpret the<audio>
element's playback functions in terms of Web Audio. Similar descriptions can happen of the UI in terms of Shadow DOM and the loading of audio data via XHR or the upcomingfetch()
API. It's not necessary to re-interpret everything all at once, however.Web Audio acknowledges that the
<audio>
element performs valuable audio loading work today by allowing the creation ofSourceNode
instances from them:Lots of questions arise, particularly if we think of media element audio playback as though it's low-level aspects were described in terms of Web Audio:
AudioContext
s at the same time?ctx.createMediaElementSource(n)
disconnect the output from the default context?ctx2.createMediaElementSource(n)
on the same media element, is it disconnected from the first?MedaiaStreamAudioSourceNode
andMediaElementAudioSourceNode
in the spec? What makes them different, particularly given that neither appear to have properties or methods and do nothing but inherit fromAudioNode
?All of this seems to indicate some confusion in, at a minimum, the types used in the design. For instance, we could answer a few of the questions if we:
MediaElementAudioSourceNode
and instead re-cast media elements as possessingMediaStream audioStream
attributes which can be connected toAudioContext
screateMediaElementSource()
in favor ofcreateMediaStreamSource()
That leaves a few open issues for which we don't currently have suggestions but believe the WG should address:
AudioContext
do media elements use by default?AudioContext
instances for the same hardware device? Chris Wilson advises that they are simply sum'd, but how is that described?AudioContext
attached to hardware? If I have multiple contexts corresponding to independent bits of hardware...how does that even happen?AudioContext
doesn't seem to support any parameters and there aren't any statics defined for "default" audio contexts corresponding to attached hardware (or methods for getting them).The text was updated successfully, but these errors were encountered: