Skip to content
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

Virtual device registration for MediaStream and friends #7

Open
hoch opened this issue Jun 5, 2019 · 2 comments
Open

Virtual device registration for MediaStream and friends #7

hoch opened this issue Jun 5, 2019 · 2 comments
Labels
AudioDeviceClient Project label for AudioDeviceClient

Comments

@hoch
Copy link
Member

hoch commented Jun 5, 2019

There was an idea floating around to integrate MediaStream to AudioDeviceClient. This is just a straw-man code example.

// These are MediaStream objects that are already opened.
const remoteConsumer;
const remoteProducer; 

// Scenario: device #6 and #7 are remote input and output devices respectively.
(async () => {
  await navigator.mediaDevices.registerAudioSink(remoteConsumer);
  await navigator.mediaDevices.registerAudioSource(remoteProducer);

  const devices = await navigator.mediaDevices.enumerateDevices();  
  const constraints = {
    mode: ‘raw’,
    outputDeviceId: devices[6].deviceId,
    inputDeviceId: devices[7].deviceId,
    callbackBufferSize: 2048,
    inputChannelCount: 2,
    outputChannelCount: 2,
  };

  const client = await navigator.mediaDevices.getAudioDeviceClient(constraints);
  await client.addModule('my-client.js');
  client.start();
})();

This needs a spec work for MediaDevices API, which might take a while. However, once we can make it the API shape looks quite sensible.

cc @alvestrand

@hoch hoch added the AudioDeviceClient Project label for AudioDeviceClient label Jun 5, 2019
@hoch hoch added this to Untriaged in Audio Device Client Jun 6, 2019
@hoch hoch moved this from Untriaged to Needs CG discussion in Audio Device Client Jun 6, 2019
@chrisguttandin
Copy link

If I understand it correctly the Screen Capture spec does support to get a MediaStream with audio from other tabs or windows. Although it seems to be not supported by any browser so far. Would it make sense to allow other tabs or windows as an input or output of an ADC as well? This would allow to build something like Soundflower in the browser.

@padenot
Copy link
Member

padenot commented Sep 30, 2019

This is best done as an API to route a MediaStream to an ADC.

A MediaStream is already a good opaque object to represent a stream of real-time media, no need to reinvent the wheel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AudioDeviceClient Project label for AudioDeviceClient
Projects
Audio Device Client
Needs CG discussion
Development

No branches or pull requests

3 participants