Closed dsanders11 closed 6 years ago
Sounds great, PR welcome :)
Now that Chrome 55 has landed the deprecation notice has been updated to specify Chrome 56 will remove the feature likely in January 2017.
Unfortunately switching to just the {facingMode: 'environment'}
constraint doesn't work well with Android as facingMode
is currently broken there.
The code could be switched to use MediaDevices.enumerateDevices()
which is the spiritual successor of MediaStreamTrack.getSources()
, but compatibility is unclear. Testing on desktop, it appears to be usable for Chrome, Firefox, and Opera. I can only test Chrome Android and it appears to be accessible there as well.
I'll work on a pull request with that functionality.
According to Chrome
MediaStreamTrack.getSources()
is deprecated and will be removed in Chrome 56 (currently in dev channel, so coming around December or January).Since the only current use of that function is to find any environment facing cameras and set a preference for it, this code could be replaced entirely by using constraints. The newer format would simply be
{facingMode: 'environment'}
to express optional preference for environment facing cameras.While making this change it would also be useful to plumb down additional constraints through
ContinuousScanner
. I've implemented this as looking for avideoConstraints
key in the options forContinuousScanner
and passing it toLocalVideoCapturer
which now takes an optionalconstraints
object.Plumbing through additional constraints is very useful for multi-camera environments. I have a setup with two cameras and allow the user to set a preference (saved to LocalStorage). I can enforce this preference by providing
{deviceId: {exact: "foobar"}}
as an additional constraint and it works great.