Skip to content

Commit

Permalink
#9 Live Streaming Enabled
Browse files Browse the repository at this point in the history
Fixed a bug as Miro suggested. Live Streaming with one camera is now possible.
Frames are being sent via UDP.
  • Loading branch information
kcuric committed Jan 3, 2020
1 parent 66312a7 commit 6c42b1d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions server/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from flask import Flask, render_template, Response

app = Flask(__name__)

import socket

app = Flask(__name__)

ip = "0.0.0.0"
port = 5005
Expand All @@ -12,10 +10,8 @@
sock.bind((ip, port))

def rec():

while True:
data, addr = sock.recvfrom(65535)
print(len(data))
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + data + b'\r\n')

Expand All @@ -25,8 +21,7 @@ def index():

@app.route('/video_feed')
def video_feed():
return Response(rec(), mimetype='multipart/x--mixed-replace; boundary=frame')

return Response(rec(), mimetype='multipart/x-mixed-replace; boundary=frame')

if __name__ == '__main__':
app.run(ssl_context='adhoc')

0 comments on commit 6c42b1d

Please sign in to comment.