cycleCamera()
cycleCamera({preferDifferentFacingMode})
Switches the local camera stream to use the next available camera device. Has no effect if there is only one camera.
This is the easiest way to switch between the front and rear camera on a mobile device. Be sure to call this method with preferDifferentFacingMode: true
if this is your intent. Without setting this flag, the method will grab the next available camera in the list, which may not be what you want. For example, newer iPhones list multiple cameras for the same facing mode, so without this flag, the method may not switch between front and rear cameras as expected.
Returns a Promise that resolves with data about the camera device. (The data is copied from the camera's MediaDeviceInfo struct.)
This method is a wrapper around updateInputSettings()
providing an easy way to switch devices without modifying other constraints. As such, an 'input-settings-updated'
event will be emitted if the device switch is successful and getInputSettings()
will reflect the new device settings.