neko/pkg/types/webrtc.go

48 lines
1.2 KiB
Go
Raw Normal View History

package types
2021-08-29 17:09:13 +02:00
import (
"errors"
"github.com/pion/webrtc/v3"
)
var (
ErrWebRTCDataChannelNotFound = errors.New("webrtc data channel not found")
2022-02-10 00:12:30 +01:00
ErrWebRTCConnectionNotFound = errors.New("webrtc connection not found")
2021-08-29 17:09:13 +02:00
)
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)
2021-11-28 18:36:47 +01:00
CreateAnswer() (*webrtc.SessionDescription, error)
2023-04-16 23:34:02 +02:00
SetRemoteDescription(webrtc.SessionDescription) error
SetCandidate(webrtc.ICECandidateInit) error
2021-02-12 22:13:55 +01:00
SetVideoBitrate(bitrate int) error
SetVideoID(videoID string) error
GetVideoID() string
2022-03-26 23:20:38 +01:00
SetPaused(isPaused bool) error
SetVideoAuto(auto bool)
VideoAuto() bool
2022-03-26 23:20:38 +01:00
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
CreatePeer(session Session, bitrate int, videoAuto bool) (*webrtc.SessionDescription, error)
2022-07-21 18:28:51 +02:00
SetCursorPosition(x, y int)
}