Closed
Bug 1497945
Opened 7 years ago
Closed 7 years ago
NotReadableError "Failed to allocate audiosource" when calling getUserMedia twice with different deviceId
Categories
(Core :: WebRTC: Audio/Video, defect, P3)
Core
WebRTC: Audio/Video
Tracking
()
RESOLVED
DUPLICATE
of bug 1238038
People
(Reporter: ibc, Unassigned)
Details
Let's assume we have, at least, two mic inputs in the computer. Then try this code in the console:
```
run();
function run()
{
console.info('run()');
let micDevices;
Promise.resolve()
// Enumerate mic devices.
.then(() =>
{
console.info('calling enumerateDevices()...');
return navigator.mediaDevices.enumerateDevices()
.then((devices) =>
{
micDevices =
devices.filter((device) => device.kind === 'audioinput');
if (micDevices.length < 2)
{
throw new Error(
'at least 2 audio input devices are needed to reproduce the issue');
}
})
})
// Use the first microphone.
.then(() =>
{
const firstMicDevice = micDevices[0];
console.info('calling getUserMedia() with first mic deviceId...');
return navigator.mediaDevices.getUserMedia(
{
audio : { deviceId: firstMicDevice.deviceId }
})
.then((stream) =>
{
// Uncomment this line (it won't fail).
// stream.getAudioTracks()[0].stop();
});
})
// Use the second microphone.
.then(() =>
{
const secondMicDevice = micDevices[1];
console.info('calling getUserMedia() with second mic deviceId...');
return navigator.mediaDevices.getUserMedia(
{
audio : { deviceId: secondMicDevice.deviceId }
});
})
.then(() =>
{
console.info('success!');
})
.catch((error) =>
{
console.error(error);
});
}
```
The second call to getUserMedia (with the second mic deviceId) will fail with NotReadableError "Failed to allocate audiosource".
However, if you stop the first track before the second call to getUserMedia, it won'r fail. For that, just uncomment the "stream.getAudioTracks()[0].stop()" line above.
Comment 1•7 years ago
|
||
potential dupe of https://bugzilla.mozilla.org/show_bug.cgi?id=1238038
Looks like it to me -- thanks :fippo. ni :padenot to confirm nothing has changed since the last comment[0] on that bug.
[0]: https://bugzilla.mozilla.org/show_bug.cgi?id=1238038#c9
Flags: needinfo?(padenot)
| Comment hidden (obsolete) |
| Comment hidden (obsolete) |
| Reporter | ||
Comment 6•7 years ago
|
||
Please, forget previous 2 comments. Indeed I had an additional cloned track of the first mic and it was alive while the second gUM, so the error makes sense.
Comment 7•7 years ago
|
||
Do we have a tracking bug we can link this to? If not I think we should have a bug in our backlog to track this work.
Flags: needinfo?(padenot)
Priority: -- → P3
Comment 9•7 years ago
|
||
Alright lets then continue over in bug 1238038.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•