Added start/stop preview camera actions

This commit is contained in:
Fabio Manganiello 2019-08-16 18:38:04 +02:00
parent c93af07333
commit 6465a6f282

View file

@ -76,6 +76,25 @@ class CameraPiPlugin(CameraPlugin):
return self._camera return self._camera
@action
def start_preview(self, **opts):
"""
Start camera preview.
:param opts: Extra options to pass to the camera (see
https://www.raspberrypi.org/documentation/usage/camera/python/README.md)
"""
camera = self._get_camera(**opts)
camera.start_preview()
@action
def stop_preview(self):
"""
Stop camera preview.
"""
camera = self._get_camera()
camera.stop_preview()
@action @action
def take_picture(self, image_file, preview=False, warmup_time=2, resize=None, **opts): def take_picture(self, image_file, preview=False, warmup_time=2, resize=None, **opts):
""" """