2020-10-23 03:54:50 +13:00
|
|
|
package types
|
|
|
|
|
2021-08-30 03:09:13 +12:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/pion/webrtc/v3"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
ErrWebRTCDataChannelNotFound = errors.New("webrtc data channel not found")
|
2022-02-10 12:12:30 +13:00
|
|
|
ErrWebRTCConnectionNotFound = errors.New("webrtc connection not found")
|
2023-05-16 05:29:39 +12:00
|
|
|
ErrWebRTCStreamNotFound = errors.New("webrtc stream not found")
|
2021-08-30 03:09:13 +12:00
|
|
|
)
|
2021-02-03 07:21:48 +13:00
|
|
|
|
2021-03-18 03:47:49 +13:00
|
|
|
type ICEServer struct {
|
|
|
|
URLs []string `mapstructure:"urls" json:"urls"`
|
2021-03-19 23:28:06 +13:00
|
|
|
Username string `mapstructure:"username" json:"username,omitempty"`
|
|
|
|
Credential string `mapstructure:"credential" json:"credential,omitempty"`
|
2021-03-18 03:47:49 +13:00
|
|
|
}
|
|
|
|
|
2020-11-26 06:41:40 +13:00
|
|
|
type WebRTCPeer interface {
|
2021-06-28 08:05:37 +12:00
|
|
|
CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error)
|
2021-11-29 06:36:47 +13:00
|
|
|
CreateAnswer() (*webrtc.SessionDescription, error)
|
2023-04-17 09:34:02 +12:00
|
|
|
SetRemoteDescription(webrtc.SessionDescription) error
|
|
|
|
SetCandidate(webrtc.ICECandidateInit) error
|
2021-02-13 10:13:55 +13:00
|
|
|
|
2023-05-16 05:29:39 +12:00
|
|
|
SetVideo(StreamSelector) error
|
|
|
|
VideoID() (string, bool)
|
2022-03-27 11:20:38 +13:00
|
|
|
SetPaused(isPaused bool) error
|
2023-05-16 05:29:39 +12:00
|
|
|
Paused() bool
|
2023-02-07 07:45:51 +13:00
|
|
|
SetVideoAuto(auto bool)
|
|
|
|
VideoAuto() bool
|
2022-03-27 11:20:38 +13:00
|
|
|
|
2021-02-13 10:13:55 +13:00
|
|
|
SendCursorPosition(x, y int) error
|
2021-02-26 02:24:17 +13:00
|
|
|
SendCursorImage(cur *CursorImage, img []byte) error
|
2021-02-03 08:43:33 +13:00
|
|
|
|
2021-08-30 05:17:10 +12:00
|
|
|
Destroy()
|
2020-11-26 06:41:40 +13:00
|
|
|
}
|
|
|
|
|
2020-10-23 03:54:50 +13:00
|
|
|
type WebRTCManager interface {
|
|
|
|
Start()
|
|
|
|
Shutdown() error
|
2021-02-03 07:21:48 +13:00
|
|
|
|
2021-03-18 03:47:49 +13:00
|
|
|
ICEServers() []ICEServer
|
2021-02-03 07:21:48 +13:00
|
|
|
|
2023-05-16 05:29:39 +12:00
|
|
|
CreatePeer(session Session) (*webrtc.SessionDescription, WebRTCPeer, error)
|
2022-07-22 04:28:51 +12:00
|
|
|
SetCursorPosition(x, y int)
|
2020-10-23 03:54:50 +13:00
|
|
|
}
|