Moved gen() into streams.py

This commit is contained in:
Joel Collins 2020-11-17 11:20:07 +00:00
parent 729f10170c
commit c9c29a7db4
2 changed files with 8 additions and 10 deletions

View file

@ -2,7 +2,14 @@ from flask import Response
from labthings import find_component
from labthings.views import PropertyView
from openflexure_microscope.api.utilities import gen
def gen(camera):
"""Video streaming generator function."""
while True:
# the obtained frame is a jpeg
frame = camera.get_frame()
yield (b"--frame\r\n" b"Content-Type: image/jpeg\r\n\r\n" + frame + b"\r\n")
class MjpegStream(PropertyView):