You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
428 B
15 lines
428 B
import time
|
|
from .base_camera import BaseCamera
|
|
|
|
|
|
class Camera(BaseCamera):
|
|
"""An emulated camera implementation that streams a repeated sequence of
|
|
files 1.jpg, 2.jpg and 3.jpg at a rate of one frame per second."""
|
|
imgs = [open(f + '.jpg', 'rb').read() for f in ['1', '2', '3']]
|
|
|
|
@staticmethod
|
|
def frames():
|
|
while True:
|
|
time.sleep(1)
|
|
yield Camera.imgs[int(time.time()) % 3]
|
|
|
|
|