WebRTC cursor: set initial state.

This commit is contained in:
Miroslav Šedivý 2021-02-17 21:55:21 +01:00
parent 5310acfbf0
commit ab34f4a53f

View File

@ -319,6 +319,15 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
// TODO: Refactor. // TODO: Refactor.
manager.curImgListeners[cursorChangePtr] = &cursorChange manager.curImgListeners[cursorChangePtr] = &cursorChange
manager.curPosListeners[cursorPositionPtr] = &cursorPosition manager.curPosListeners[cursorPositionPtr] = &cursorPosition
// send initial cursor image
cur := manager.desktop.GetCursorImage()
cursorChange(cur)
// send initial cursor position
x, y := manager.desktop.GetCursorPosition()
manager.logger.Warn().Int("x", x).Int("y", y).Msg("got cursor position")
cursorPosition(x, y)
}) })
dataChannel.OnMessage(func(message webrtc.DataChannelMessage) { dataChannel.OnMessage(func(message webrtc.DataChannelMessage) {