Browse Source

request webrtc video on demand

main
Hendrik Langer 4 years ago
parent
commit
8897f1f869
  1. 1
      raspberry/roberto/views/frontend/templates/index.html
  2. 7
      raspberry/roberto/views/websocket/routes.py

1
raspberry/roberto/views/frontend/templates/index.html

@ -149,6 +149,7 @@
socket.on('connect', function(){ socket.on('connect', function(){
console.log("Connected...!", socket.connected) console.log("Connected...!", socket.connected)
socket.emit('request_webrtc_video', 'webrtc');
}); });
socket.on('message', (data) => { socket.on('message', (data) => {

7
raspberry/roberto/views/websocket/routes.py

@ -77,6 +77,11 @@ def battery_message(data):
sid = request.sid sid = request.sid
socketio.emit('battery', data, room=ROOM, skip_sid=sid) socketio.emit('battery', data, room=ROOM, skip_sid=sid)
@socketio.on('request_webrtc_video') # ok
def request_webrtc_video(data):
sid = request.sid
webrtccamera.connect_client(sid, ROOM)
@socketio.on('text') @socketio.on('text')
def display_text(text): def display_text(text):
print("display_text()") print("display_text()")
@ -101,7 +106,7 @@ def connect():
sid = request.sid sid = request.sid
print("Received Connect message from %s" % sid) print("Received Connect message from %s" % sid)
join_room(ROOM) join_room(ROOM)
webrtccamera.connect_client(sid, ROOM) #webrtccamera.connect_client(sid, ROOM)
@socketio.on_error_default @socketio.on_error_default
def default_error_handler(e): def default_error_handler(e):

Loading…
Cancel
Save