From 626164df893041e154410c688709d5faa9bdafd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 7 Feb 2021 17:29:40 +0100 Subject: [PATCH] SignalVideo reply. --- internal/types/message/messages.go | 4 ++-- internal/websocket/handler/signal.go | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/internal/types/message/messages.go b/internal/types/message/messages.go index 51a4130b..292e10f8 100644 --- a/internal/types/message/messages.go +++ b/internal/types/message/messages.go @@ -60,8 +60,8 @@ type SignalAnswer struct { } type SignalVideo struct { - Event string `json:"event,omitempty"` - VideoID string `json:"video_id"` + Event string `json:"event,omitempty"` + Video string `json:"video"` } ///////////////////////////// diff --git a/internal/websocket/handler/signal.go b/internal/websocket/handler/signal.go index 6d200c09..5c32e15c 100644 --- a/internal/websocket/handler/signal.go +++ b/internal/websocket/handler/signal.go @@ -57,5 +57,14 @@ func (h *MessageHandlerCtx) signalVideo(session types.Session, payload *message. return nil } - return peer.SetVideoID(payload.VideoID) + err := peer.SetVideoID(payload.Video) + if err != nil { + return err + } + + return session.Send( + message.SignalVideo{ + Event: event.SIGNAL_VIDEO, + Video: payload.Video, + }) }