|
|
@ -11,23 +11,23 @@ from flask import Response |
|
|
|
def index(): |
|
|
|
return render_template('index.html') |
|
|
|
|
|
|
|
#def gen(camera): |
|
|
|
# """Video streaming generator function.""" |
|
|
|
# while True: |
|
|
|
# frame = camera.get_frame() |
|
|
|
# yield (b'--frame\r\n' |
|
|
|
# b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n') |
|
|
|
# |
|
|
|
# |
|
|
|
#@frontend_blueprint.route('/video_feed') |
|
|
|
#def video_feed(): |
|
|
|
# """Video streaming route. Put this in the src attribute of an img tag.""" |
|
|
|
# from roberto import camera |
|
|
|
# camera.__init__() |
|
|
|
# response = Response(gen(camera), |
|
|
|
# mimetype='multipart/x-mixed-replace; boundary=frame') |
|
|
|
# response.headers.add('X-Accel-Buffering', 'no') |
|
|
|
# return response |
|
|
|
def gen(camera): |
|
|
|
"""Video streaming generator function.""" |
|
|
|
while True: |
|
|
|
frame = camera.get_frame() |
|
|
|
yield (b'--frame\r\n' |
|
|
|
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n') |
|
|
|
|
|
|
|
|
|
|
|
@frontend_blueprint.route('/video_feed') |
|
|
|
def video_feed(): |
|
|
|
"""Video streaming route. Put this in the src attribute of an img tag.""" |
|
|
|
from roberto import camera |
|
|
|
camera.__init__() |
|
|
|
response = Response(gen(camera), |
|
|
|
mimetype='multipart/x-mixed-replace; boundary=frame') |
|
|
|
response.headers.add('X-Accel-Buffering', 'no') |
|
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
@frontend_blueprint.route('/gamepad.js') |
|
|
|