neko/internal/types/webrtc.go

40 lines
953 B
Go
Raw Normal View History

package types
2021-08-29 17:09:13 +02:00
import (
"errors"
"github.com/pion/webrtc/v3"
)
var (
ErrWebRTCVideoNotFound = errors.New("webrtc video not found")
ErrWebRTCDataChannelNotFound = errors.New("webrtc data channel not found")
)
2021-02-02 19:21:48 +01:00
2021-03-17 15:47:49 +01:00
type ICEServer struct {
URLs []string `mapstructure:"urls" json:"urls"`
2021-03-19 11:28:06 +01:00
Username string `mapstructure:"username" json:"username,omitempty"`
Credential string `mapstructure:"credential" json:"credential,omitempty"`
2021-03-17 15:47:49 +01:00
}
2020-11-25 18:41:40 +01:00
type WebRTCPeer interface {
CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error)
2020-11-25 18:41:40 +01:00
SignalAnswer(sdp string) error
2021-02-02 20:43:33 +01:00
SignalCandidate(candidate webrtc.ICECandidateInit) error
2021-02-12 22:13:55 +01:00
2021-02-05 17:57:33 +01:00
SetVideoID(videoID string) error
2021-02-12 22:13:55 +01:00
SendCursorPosition(x, y int) error
SendCursorImage(cur *CursorImage, img []byte) error
2021-02-02 20:43:33 +01:00
2021-08-29 19:17:10 +02:00
Destroy()
2020-11-25 18:41:40 +01:00
}
type WebRTCManager interface {
Start()
Shutdown() error
2021-02-02 19:21:48 +01:00
2021-03-17 15:47:49 +01:00
ICEServers() []ICEServer
2021-02-02 19:21:48 +01:00
2021-02-07 17:07:55 +01:00
CreatePeer(session Session, videoID string) (*webrtc.SessionDescription, error)
}