From e75cb62c012b38aa2c60ca0e4c6f44b2268679cc Mon Sep 17 00:00:00 2001 From: David Goelzhaeuser Date: Sun, 17 Nov 2019 20:51:55 +0100 Subject: [PATCH] server: Add JPEG route Change-type: minor Signed-off-by: Your Name --- balena-cam/app/server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/balena-cam/app/server.py b/balena-cam/app/server.py index 68f687f..c3c4574 100644 --- a/balena-cam/app/server.py +++ b/balena-cam/app/server.py @@ -153,6 +153,10 @@ async def mjpeg_handler(request): await response.write(b"\r\n") return response +async def jpeg_handler(request): + response = web.Response(body=await camera_device.get_jpeg_frame(), content_type="image/jpeg") + return response + async def config(request): return web.Response( content_type='application/json', @@ -216,5 +220,6 @@ def checkDeviceReadiness(): app.router.add_get('/style.css', stylesheet) app.router.add_post('/offer', offer) app.router.add_get('/mjpeg', mjpeg_handler) + app.router.add_get('/jpeg', jpeg_handler) app.router.add_get('/ice-config', config) web.run_app(app, port=80)