moved capture StopStream to websockets events.

This commit is contained in:
Miroslav Šedivý
2020-12-02 17:36:06 +01:00
parent 0d2f3405bb
commit 81b3fbd673
4 changed files with 12 additions and 14 deletions

View File

@ -7,6 +7,11 @@ import (
)
func (h *MessageHandlerCtx) SessionConnected(session types.Session) error {
// start streaming, when first member connects
if !h.capture.Streaming() {
h.capture.StartStream()
}
if err := h.systemInit(session); err != nil {
return err
}
@ -30,6 +35,11 @@ func (h *MessageHandlerCtx) SessionConnected(session types.Session) error {
}
func (h *MessageHandlerCtx) SessionDisconnected(session types.Session) error {
// Stop streaming, if last member disonnects
if h.capture.Streaming() && !h.sessions.HasConnectedMembers() {
h.capture.StopStream()
}
// clear host if exists
if session.IsHost() {
h.desktop.ResetKeys()