W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > June 2020

Re: [mediacapture-main] Add semantics choice to getUserMedia() for in-browser picker. (#667)

From: guest271314 via GitHub <sysbot+gh@w3.org>
Date: Sat, 20 Jun 2020 22:35:27 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-647052797-1592692526-sysbot+gh@w3.org>
@getify Another alternative is to file an issue with the service to resolve

>  and their UI doesn't let me choose what mic or camera I want... I 

which should be possible utilizing the current iteration (using `label`s of `enumerateDevices()`) and selecting device by `deviceId`. To test hot-plugged a USB camera labeled `"Digital_Camera (<UUID>)"`

navigator.mediaDevices.getUserMedia({video: true})
.then(async stream => {
  const devices = await navigator.mediaDevices.enumerateDevices();
  const {deviceId} = devices.find(({label}) => label === 'Digital_Camera (093a:2700)')
  let [track] = stream.getVideoTracks();
  console.log(await track.getConstraints());
  track.stop();
  stream = await navigator.mediaDevices.getUserMedia({video: {deviceId: {exact: deviceId}}});
  [track] = stream.getVideoTracks();
  console.log(await track.getConstraints());
  const v = document.createElement('video');
  v.controls = v.autoplay = true;
  document.body.appendChild(v);
  v.srcObject = stream;           
});

-- 
GitHub Notification of comment by guest271314
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/pull/667#issuecomment-647052797 using your GitHub account
Received on Saturday, 20 June 2020 22:35:29 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 6 May 2023 21:19:51 UTC