Wednesday, 11 December 2019

JavaScript get permission for Audio.setSinkId

I'm trying to change the sinkId at an Audio-Element in a chrome app.

Code:

var audio = new Audio();
audio.setSinkId("communications");

I'll get this error:

DOMException: No permission to use requested device

So to get the permission I tried to do that:

navigator.webkitGetUserMedia({
    audio: true
}, (stream) => {
    console.log("stream: ", stream);
}, (error) => {
    console.log("error: ", error);
});

But now I get this:

error:
NavigatorUserMediaError {name: "InvalidStateError", message: "", constraintName: ""}

I don't know, whether

  • 'audio' is not available (but actually it should)
  • I need a secure connection (but how do I get this at a chrome app?)


from JavaScript get permission for Audio.setSinkId

No comments:

Post a Comment