File tree Expand file tree Collapse file tree
components/AudioOutputSelect Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,12 +19,12 @@ export default function AudioOutputSelect(props: Props) {
1919 useEffect ( ( ) => {
2020 const refreshDevices = async ( ) => {
2121 try {
22- // Webkit sucks, we need to request permissions for inputs, when we only
23- // need outputs
24- // const test = await navigator.mediaDevices.getUserMedia({
25- // audio: true,
26- // video: false ,
27- // });
22+ // This will display a popup to users asking them to give microphone access,
23+ // which is lame because we only need outputs.
24+ // Does not work on macOS/linux for now.
25+ await navigator . mediaDevices . getUserMedia ( {
26+ audio : true ,
27+ } ) ;
2828 const devices = await navigator . mediaDevices . enumerateDevices ( ) ;
2929 const audioDevices = devices . filter (
3030 ( device ) => device . kind === 'audiooutput' && device . deviceId !== '' ,
Original file line number Diff line number Diff line change @@ -37,9 +37,14 @@ class Player {
3737 this . track = null ;
3838
3939 this . audio . defaultPlaybackRate = mergedOptions . playbackRate ;
40- // @ts -ignore
41- // TODO:
42- // this.audio.setSinkId(mergedOptions.audioOutputDevice);
40+
41+ // FIXME: this will not do anything unless we recall getUserMedia()
42+ if ( 'setSinkId' in this . audio ) {
43+ // eslint-disable-next-line
44+ // @ts -ignore
45+ this . audio . setSinkId ( mergedOptions . audioOutputDevice ) ;
46+ }
47+
4348 this . audio . playbackRate = mergedOptions . playbackRate ;
4449 this . audio . volume = mergedOptions . volume ;
4550 this . audio . muted = mergedOptions . muted ;
You can’t perform that action at this time.
0 commit comments