问题
When connected to a mobile browser, the audio always defaults to the audio-only speakers (i.e. phone speakers that are close to the ear; i don't know what this is called) instead of the loud speakers. How do I make it use the loud speakers by default and give the user a choice of which speaks to use?
The documentation for mobile SDKs have this but in the JavaScript SDK, only the audio source has an equivalent. Isn't this possible in opentok? If not, what workaround can I do?
回答1:
Currently there is no option to specify the output device via the OpenTok JS SDK.
It might be possible using https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId but I don't know what the browser compatibility for that looks like. Unfortunately OT.getDevices() only returns IDs for input devices so you'd need to get the output device ID using native methods.
I'd suggest you request this feature by creating a support ticket: https://support.tokbox.com/hc/en-us/requests/new
来源:https://stackoverflow.com/questions/48902138/how-to-change-audio-output-in-opentok-javascript-sdk