Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
server: Add JPEG route
Browse files Browse the repository at this point in the history
Change-type: minor
Signed-off-by: Your Name <your email>
  • Loading branch information
idoodler committed Dec 20, 2019
1 parent 4720c75 commit e75cb62
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions balena-cam/app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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)

0 comments on commit e75cb62

Please sign in to comment.