def streaming_video(url_root):
'''Video streaming generator function'''
try:
while True:
if remote_control_cozmo:
image = get_annotated_image()
img_io = io.BytesIO()
image.save(img_io, 'PNG')
img_io.seek(0)
yield (b'--frame\r\n'
b'Content-Type: image/png\r\n\r\n' + img_io.getvalue() + b'\r\n')
else:
asyncio.sleep(.1)
except cozmo.exceptions.SDKShutdown:
# Tell the main flask thread to shutdown
requests.post(url_root + 'shutdown')
评论列表
文章目录