3

Is there a way to programmatically list available input devices and allow to change the current one being used for the WebSpeech API?

I'm aware Chrome shows a video icon on the address bar where a device can be chosen, but I want to make this setting available on the web app itself.

Raisen
  • 4,385
  • 2
  • 25
  • 40

2 Answers2

1

Yes, there's a way- take a look at https://webaudiodemos.appspot.com/input/index.html, it lets the user select the input. PS: This works just for chrome.

Also you can look this example using webrtc, however I'm not sure if it can be integrated with webspeechapi: https://webrtc.github.io/samples/src/content/devices/input-output/

Also, take a look at this post: https://developers.google.com/web/updates/2015/10/media-devices It has a lot of information

  • Thanks Francinaldo, I'm marking this as the answer. I tried the [first link](https://webaudiodemos.appspot.com/input/index.html) and I get "default (selection not supported)" under the dropdown - did you get the same? I tried on Chrome/Mac. – Raisen Oct 11 '17 at 23:27
0

Sorry to burst your buble but it can't be done, the only way to have access to the devices is using the system API's and the web browser limits your access to specific API's that he chooses to expose, unfortunately for you the device related ones are not exposed.

On a side note, think of the repercussions of exposing your devices to every website you visit...

Adi
  • 2,074
  • 22
  • 26
  • Thanks. I get the point of exposing devices, but this exposure should only be allowed for sites which I gave authorization to. – Raisen Oct 11 '17 at 23:29
  • You are looking at it from the user point of view, but the responsibility of the browser is to protect the user, so unless the user specifically configured it the browser will hide all and any device access – Adi Oct 12 '17 at 14:07