CameraStream¶
A CameraStream is a MediaStream from an attached camera device or webcam.
In [1]:
from ipywebrtc import CameraStream
With constraints¶
You can pass constraints to the camera:
In [2]:
camera = CameraStream(constraints=
{'facing_mode': 'user',
'audio': False,
'video': { 'width': 640, 'height': 480 }
})
camera
Front and back camera¶
Or use the two convenience methods:
In [3]:
# this is a shorter way to get the user facing camera
front_camera = CameraStream.facing_user(audio=False)
# or the back facing camera
back_camera = CameraStream.facing_environment(audio=False)
In [4]:
back_camera