Intent to Ship: Audio Output Devices API
Contact emails
gui...@chromium.org, h...@chromium.org, to...@chromium.org
Spec
https://w3c.github.io/mediacapture-output/
Summary
This feature incorporates a set of JavaScript APIs that let a Web application direct the audio output of a media element to authorized devices other than the system or user agent default.
Link to “Intent to Implement” blink-dev discussion
Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
No. It is supported on all desktop platforms (Windows, Mac, Linux, and Chrome OS).
It is not supported on Android (including WebView) because the Android platform does not provide the ability to programmatically switch individual audio streams to different audio devices. We plan to support Android once the platform provides the required underlying support.
Demo link
https://webrtc.github.io/samples/src/content/devices/multi/
https://guidou.github.io/setsinkid-demo.html
Compatibility Risk
There is some compatibility risk, as we are not aware of any plans to provide support for this feature in other browsers. The risk is mitigated by the fact that the surface area of the change is small (only the setSinkId function and the sinkId field on HTML media elements), and the fact that we do not expect the specification to change in an important way in the future with regards to these extensions.
The compatibility risk has not changed since the intent to implement.
OWP launch tracking bug
Entry on the feature dashboard
https://www.chromestatus.com/feature/4621603249848320
Other relevant links and info
Security and privacy are being reviewed at https://crbug.com/545992
The feature has been behind a flag since M45.To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Why the `setSinkId` function is not available on the AudioContext?When will it be available?I'm on M45 with the flag.
The main reason is the spec declares the WebAudio extensions as "a work in progress", and presents 4 possible implementation options, all open for discussion. We prefer to first ship the HTMLMediaElement extesions, which are well defined, and work on the WebAudio extensions when the spec reflects the results of the WebAudio discussion and is no longer a work in progress.
This feature is a lot like MediaSession in that it needs to interact with audio output, but since there is no suitable primitive for that on the web platform we end up extending both HTMLMediaElement and AudioContext. For both this intent and MediaSession, shipping with only support for HTMLMediaElement isn't out of the question, but how much extra work would it be to finish the Web Audio integration? There is a risk that this reveals some issues that would affect the HTMLMediaElement API as well, after all.
I have an old issue on the spec, and there's also a naming question that would be good to explicitly accept or reject before shipping.
Looking at the implementation, I also see that there's a failure case that's not in the spec, namely the AbortError if there is no WebMediaPlayer backend when setSinkId() is called. Can't this case simply be handled, so that the correct output device is used once needed, much like volume can be set in advance? If not, then this is similar to a MediaSession issue, where we don't want to allow assigning mediaElement.session if there is a media player backend and thus a chance that audio is already playing. We did that with a networkState check. Perhaps the inverse of that check, or checking readyState>HAVE_NOTHING would work for the spec. guidou@, since you wrote the code in question, can you file a spec issue describing what the requirements are?
On Tue, Oct 27, 2015 at 12:21 AM, 'Harald Alvestrand' via blink-dev <blin...@chromium.org> wrote:
There's ongoing discussion in the W3C (I have a meeting this afternoon about it).My sense is that people are looking for a superset, not a subset, of the functionality that's covered by the intent-to-ship.You can find the github and bug tracker via the WG page:Please file a bug saying that the bugtracker link should be in the document!
On Mon, Oct 26, 2015 at 7:51 PM, Rick Byers <rby...@chromium.org> wrote:Seems like there hasn't been much progress on this WebAudio issue. In general we like our high-level features to be explained by low-level primitives, but it can be reasonable to ship the higher level features that have consensus while still working out details in the primitives. Chris, what's your opinion on shipping the HTMLMediaElement piece here before having the WebAudio piece ready?Where are issues tracked for this spec? There's no GitHub or Bugzilla link in the spec for issue tracking as far as I can see.Also, have there been any conversations with other browser vendors about this API at all? We should at least be reaching out to see if anyone has any interest in helping to define this API before we ship it. But if we've asked and it's just not interesting to any of the other vendors, then that's fine.On Sun, Oct 25, 2015 at 4:45 AM, Guido <gui...@chromium.org> wrote:On Sunday, October 25, 2015 at 6:43:09 AM UTC+1, Yehonathan Sharvit wrote:Why the `setSinkId` function is not available on the AudioContext?When will it be available?I'm on M45 with the flag.The main reason is the spec declares the WebAudio extensions as "a work in progress", and presents 4 possible implementation options, all open for discussion. We prefer to first ship the HTMLMediaElement extesions, which are well defined, and work on the WebAudio extensions when the spec reflects the results of the WebAudio discussion and is no longer a work in progress.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
On Thursday, October 29, 2015 at 4:14:58 PM UTC+1, Philip Jägenstedt wrote:This feature is a lot like MediaSession in that it needs to interact with audio output, but since there is no suitable primitive for that on the web platform we end up extending both HTMLMediaElement and AudioContext. For both this intent and MediaSession, shipping with only support for HTMLMediaElement isn't out of the question, but how much extra work would it be to finish the Web Audio integration? There is a risk that this reveals some issues that would affect the HTMLMediaElement API as well, after all.Most of the work to implement this feature was improvements in the Chromium audio stack to make it better at supporting different audio output devices.The Blink work for the HTMLMediaElement extensions is, for the most part, plumbing to let WebMediaPlayer implementations take advantage of the improvements in the Chromium lower layers.The WebAudio integration work will be largely orthogonal to the HTMLMediaElement work, so I think it's OK to ship them separately.
I have an old issue on the spec, and there's also a naming question that would be good to explicitly accept or reject before shipping.Looking at the implementation, I also see that there's a failure case that's not in the spec, namely the AbortError if there is no WebMediaPlayer backend when setSinkId() is called. Can't this case simply be handled, so that the correct output device is used once needed, much like volume can be set in advance? If not, then this is similar to a MediaSession issue, where we don't want to allow assigning mediaElement.session if there is a media player backend and thus a chance that audio is already playing. We did that with a networkState check. Perhaps the inverse of that check, or checking readyState>HAVE_NOTHING would work for the spec. guidou@, since you wrote the code in question, can you file a spec issue describing what the requirements are?The case when there is no WebMediaPlayer is being addressed in this CL. We are handling it similarly to the volume case, performing validity checks on the sink ID and saving it for future use if the checks pass. This is consistent with the current text of the spec.
On a related note, this feature recently got approval from the privacy and security reviews (crbug.com/545992).
On Thu, Oct 29, 2015 at 6:20 PM, Guido <gui...@chromium.org> wrote:On Thursday, October 29, 2015 at 4:14:58 PM UTC+1, Philip Jägenstedt wrote:This feature is a lot like MediaSession in that it needs to interact with audio output, but since there is no suitable primitive for that on the web platform we end up extending both HTMLMediaElement and AudioContext. For both this intent and MediaSession, shipping with only support for HTMLMediaElement isn't out of the question, but how much extra work would it be to finish the Web Audio integration? There is a risk that this reveals some issues that would affect the HTMLMediaElement API as well, after all.Most of the work to implement this feature was improvements in the Chromium audio stack to make it better at supporting different audio output devices.The Blink work for the HTMLMediaElement extensions is, for the most part, plumbing to let WebMediaPlayer implementations take advantage of the improvements in the Chromium lower layers.The WebAudio integration work will be largely orthogonal to the HTMLMediaElement work, so I think it's OK to ship them separately.How does Web Audio integrate with the lower layers of the audio stack where support for different audio output devices has been added?
Even if shipping separately is an option, I think we must at least have high confidence in what the API will look like for Web Audio, because certain combinations of HTMLMediaElement and AudioContext extensions are harder to justify than others.In particular, having AudioContext.addSinkId()/removeSinkId() but restricting HTMLMediaElement to just one audio output device (media files with audio tracks in multiple languages exist) would be sad.Also, the `new AudioContext({ sinkId: requestedSinkId })` doesn't go great with an HTMLMediaElement solution that's allowed to change the sink at any time, because using createMediaStreamDestination() you could get the AudioContext output into an HTMLMediaElement.This really only leaves the setSinkId() proposal for AudioContext, so is this the API you expect to implement? modules/webaudio/OWNERS, do you think that API will work?
--
You received this message because you are subscribed to a topic in the Google Groups "blink-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/a/chromium.org/d/topic/blink-dev/ELz4SxMwa0U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blink-dev+...@chromium.org.
On Monday, November 2, 2015 at 2:58:15 PM UTC+1, Philip Jägenstedt wrote:On Thu, Oct 29, 2015 at 6:20 PM, Guido <gui...@chromium.org> wrote:On Thursday, October 29, 2015 at 4:14:58 PM UTC+1, Philip Jägenstedt wrote:This feature is a lot like MediaSession in that it needs to interact with audio output, but since there is no suitable primitive for that on the web platform we end up extending both HTMLMediaElement and AudioContext. For both this intent and MediaSession, shipping with only support for HTMLMediaElement isn't out of the question, but how much extra work would it be to finish the Web Audio integration? There is a risk that this reveals some issues that would affect the HTMLMediaElement API as well, after all.Most of the work to implement this feature was improvements in the Chromium audio stack to make it better at supporting different audio output devices.The Blink work for the HTMLMediaElement extensions is, for the most part, plumbing to let WebMediaPlayer implementations take advantage of the improvements in the Chromium lower layers.The WebAudio integration work will be largely orthogonal to the HTMLMediaElement work, so I think it's OK to ship them separately.How does Web Audio integrate with the lower layers of the audio stack where support for different audio output devices has been added?One of the main integration points is the WebAudioDevice interface. In the Chromium implementation of this interface, an actual Chromium audio output device is created and an audio render callback function is supplied. The current implementation of this interface is hardcoded to use the default device (see here).Supporting multiple devices would require being able to supply the WebAudioDevice implementation with the ID of the sink to use, so that it can be passed to the Chromium AudioDeviceFactory.WebAudioDevice is used by AudioDestination.The HTMLMediaElement extensions integrate with Chromium using the WebMediaPlayer interface. WebMediaPlayer integrates with WebAudio using the WebAudioSourceProvider interface.WebMediaPlayer implementations use this to redirect audio to WebAudio. In this case, audio to the WebMediaPlayer is to WebAudio instead of the Chromium audio device, so the media player's sink ID is effectively ignored. This is what happens when an HTMLMediaElement outputs to WebAudio.
Even if shipping separately is an option, I think we must at least have high confidence in what the API will look like for Web Audio, because certain combinations of HTMLMediaElement and AudioContext extensions are harder to justify than others.In particular, having AudioContext.addSinkId()/removeSinkId() but restricting HTMLMediaElement to just one audio output device (media files with audio tracks in multiple languages exist) would be sad.Also, the `new AudioContext({ sinkId: requestedSinkId })` doesn't go great with an HTMLMediaElement solution that's allowed to change the sink at any time, because using createMediaStreamDestination() you could get the AudioContext output into an HTMLMediaElement.This really only leaves the setSinkId() proposal for AudioContext, so is this the API you expect to implement? modules/webaudio/OWNERS, do you think that API will work?At this point I don't know what is the best choice to add support for multiple devices to WebAudio, so we need to think more about it.However, I don't see that as an impediment to ship the current HTMLMediaElement extensions, since their behavior should not change due to the WebAudio integration work.The reason is that the audio stack is accessed independently in both cases.As for the integration between them, I see two main cases:1. WebAudio can output to an HTMLMediaElement. In this case the sink is determined by the HTMLMediaElement.2. the HTMLMediaElement can output to WebAudio. In this case the sink is determined by WebAudio.Both cases work today and I don't expect that to change after we allow WebAudio to output to different devices.What do you think?
On Thu, Nov 5, 2015 at 12:26 PM, Guido <gui...@chromium.org> wrote:
On Monday, November 2, 2015 at 2:58:15 PM UTC+1, Philip Jägenstedt wrote:On Thu, Oct 29, 2015 at 6:20 PM, Guido <gui...@chromium.org> wrote:On Thursday, October 29, 2015 at 4:14:58 PM UTC+1, Philip Jägenstedt wrote:This feature is a lot like MediaSession in that it needs to interact with audio output, but since there is no suitable primitive for that on the web platform we end up extending both HTMLMediaElement and AudioContext. For both this intent and MediaSession, shipping with only support for HTMLMediaElement isn't out of the question, but how much extra work would it be to finish the Web Audio integration? There is a risk that this reveals some issues that would affect the HTMLMediaElement API as well, after all.Most of the work to implement this feature was improvements in the Chromium audio stack to make it better at supporting different audio output devices.The Blink work for the HTMLMediaElement extensions is, for the most part, plumbing to let WebMediaPlayer implementations take advantage of the improvements in the Chromium lower layers.The WebAudio integration work will be largely orthogonal to the HTMLMediaElement work, so I think it's OK to ship them separately.How does Web Audio integrate with the lower layers of the audio stack where support for different audio output devices has been added?One of the main integration points is the WebAudioDevice interface. In the Chromium implementation of this interface, an actual Chromium audio output device is created and an audio render callback function is supplied. The current implementation of this interface is hardcoded to use the default device (see here).Supporting multiple devices would require being able to supply the WebAudioDevice implementation with the ID of the sink to use, so that it can be passed to the Chromium AudioDeviceFactory.WebAudioDevice is used by AudioDestination.The HTMLMediaElement extensions integrate with Chromium using the WebMediaPlayer interface. WebMediaPlayer integrates with WebAudio using the WebAudioSourceProvider interface.WebMediaPlayer implementations use this to redirect audio to WebAudio. In this case, audio to the WebMediaPlayer is to WebAudio instead of the Chromium audio device, so the media player's sink ID is effectively ignored. This is what happens when an HTMLMediaElement outputs to WebAudio.So for Web Audio it looks like the dependency is:blink::DefaultAudioDestinationHandler → blink::AudioDestination → blink::WebAudioDevice → content::RendererWebAudioDeviceImpl → media::AudioOutputDevice → ??? → media::AudioOutputStream → platform implementations
What does this look like starting at HTMLMediaElement, what is the highest-level common point? Is that a point where it's possible to switch the audio output device, or will that have to be implemented separately for Web Audio?
Even if shipping separately is an option, I think we must at least have high confidence in what the API will look like for Web Audio, because certain combinations of HTMLMediaElement and AudioContext extensions are harder to justify than others.In particular, having AudioContext.addSinkId()/removeSinkId() but restricting HTMLMediaElement to just one audio output device (media files with audio tracks in multiple languages exist) would be sad.
It seems to me that since you can pipe the audio from AudioContext to HTMLMediaElement and vice-versa, no differences in API capabilities would make sense, since you circumvent them by piping the audio to place with the more capable API. (This could of course mysteriously fail, but that would be a very unfortunate API.)
In other words, I think shipping HTMLMediaElement.setSinkId() excludes later shipping `new AudioContext({ sinkId: requestedSinkId })` which is less capable, so we should be clear that we're making that decision now and have that option removed from the table.
By the same reasoning, I also don't think it would make sense to ship AudioContext.addSinkId()/removeSinkId() later without adding the same capabilities to HTMLMediaElement, which you might do by moving setSinkId() to AudioTrack, which unfortunately isn't implemented yet.
So in summary, I'd like to make explicit what the underlying model is:
- Can the audio output device be changed while playback is ongoing? (yes)
- Can multiple audio devices be used to play two synchronized streams?
And then how that model is made to work for both HTMLMediaElement and Web Audio, or perhaps why divergent capabilities for these is justified, if that's the conclusion.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
LGTM2
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
LGTM2
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
LGTM3.:DG<
You received this message because you are subscribed to a topic in the Google Groups "blink-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/a/chromium.org/d/topic/blink-dev/ELz4SxMwa0U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blink-dev+...@chromium.org.
Intent to Ship: Audio Output Devices API
Contact emails
gui...@chromium.org, h...@chromium.org, to...@chromium.org
Spec
https://w3c.github.io/mediacapture-output/
Summary
This feature incorporates a set of JavaScript APIs that let a Web application direct the audio output of a media element to authorized devices other than the system or user agent default.
Link to “Intent to Implement” blink-dev discussion
Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
No. It is supported on all desktop platforms (Windows, Mac, Linux, and Chrome OS).
It is not supported on Android (including WebView) because the Android platform does not provide the ability to programmatically switch individual audio streams to different audio devices. We plan to support Android once the platform provides the required underlying support.
Demo link
https://webrtc.github.io/samples/src/content/devices/multi/
https://guidou.github.io/setsinkid-demo.html
Compatibility Risk
There is some compatibility risk, as we are not aware of any plans to provide support for this feature in other browsers. The risk is mitigated by the fact that the surface area of the change is small (only the setSinkId function and the sinkId field on HTML media elements), and the fact that we do not expect the specification to change in an important way in the future with regards to these extensions.
The compatibility risk has not changed since the intent to implement.
OWP launch tracking bug
Entry on the feature dashboard
https://www.chromestatus.com/feature/4621603249848320
Other relevant links and info
Security and privacy are being reviewed at https://crbug.com/545992
The feature has been behind a flag since M45.