Documentation ¶
Index ¶
- Constants
- func Decode(in string, obj interface{})
- func Encode(obj interface{}) string
- func ModAnswer(sd *webrtc.SessionDescription) *webrtc.SessionDescription
- func MustReadStdin() string
- func RTPHeaderToString(fh rtp.Header) string
- func RTPToString(pkt *rtp.Packet) string
- func ServeListen(backEndConfig *configs.BackendConfig, frontEndConfig *configs.FrontendConfig, ...) error
- func VP8FrameHeaderToString(fh *vp8.FrameHeader) string
- type PeerClient
- type PeerClientType
- type Server
- type SignalMessage
- type SignalMessageType
- type WebRTCService
- func (svc *WebRTCService) CreatePlaybackConnection(client *PeerClient) error
- func (svc *WebRTCService) CreateRecordingConnection(client *PeerClient) error
- func (svc *WebRTCService) HasRecordings() bool
- func (svc *WebRTCService) SaveAudio(id string, packets *bytes.Buffer)
- func (svc *WebRTCService) SaveVideo(id string, packets *bytes.Buffer)
Constants ¶
const ( // PctUndecided - undetermined PctUndecided = PeerClientType(iota) // PctRecord - recording client PctRecord = PeerClientType(iota) // PctPlayback - playback client PctPlayback = PeerClientType(iota) )
const ( // SmUndefined - undefined value SmUndefined = SignalMessageType(iota) // SmRecord - browser client sends local browser session description to server and server initiates recording SmRecord // SmAnswer - server responds with remote peer description SmAnswer // SmPlay - browser client sends to server to start streaming back the recorded video SmPlay // SmError - error SmError )
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(in string, obj interface{})
Decode decodes the input from base64 It can optionally unzip the input after decoding
func Encode ¶
func Encode(obj interface{}) string
Encode encodes the input in base64 It can optionally zip the input before encoding
func ModAnswer ¶
func ModAnswer(sd *webrtc.SessionDescription) *webrtc.SessionDescription
ModAnswer modifies the remote session description to work around known issues.
func MustReadStdin ¶
func MustReadStdin() string
MustReadStdin blocks until input is received from stdin
func RTPHeaderToString ¶
VP8FrameHeaderToString compiles a vp8 video frame header fields into a string for logging.
func RTPToString ¶
RTPToString compiles the rtp header fields into a string for logging.
func ServeListen ¶
func ServeListen(backEndConfig *configs.BackendConfig, frontEndConfig *configs.FrontendConfig, webRTCConfig *configs.WebRTCConfig, logger hclog.Logger) error
ServeListen creates a new frontend server and attempts to listen.
func VP8FrameHeaderToString ¶
func VP8FrameHeaderToString(fh *vp8.FrameHeader) string
VP8FrameHeaderToString compiles a vp8 video frame header fields into a string for logging.
Types ¶
type PeerClient ¶
type PeerClient struct {
// contains filtered or unexported fields
}
PeerClient represents a server-side client used as a peer to the browser client.
func CreateNewPeerClient ¶
func CreateNewPeerClient(conn *websocket.Conn, services *WebRTCService, logger hclog.Logger) (*PeerClient, error)
CreateNewPeerClient creates a new server peer client.
func (*PeerClient) Close ¶
func (c *PeerClient) Close()
Close - closes a client's peer and signal connections.
func (*PeerClient) IsClosed ¶
func (c *PeerClient) IsClosed() bool
IsClosed checks to see if this client has been shutdown
type PeerClientType ¶
type PeerClientType int
PeerClientType represents the types of signal messages
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements a WebRTC signal server used to locate and connect up with peers. In this simple case the peer is the server.
type SignalMessage ¶
type SignalMessage struct { Op string `json:"op"` Data string `json:"data"` // contains filtered or unexported fields }
SignalMessage represents the format of a signal message over the websocket
func NewSignalMessage ¶
func NewSignalMessage(t SignalMessageType, data string) *SignalMessage
NewSignalMessage creates a new message ready to be transported over the websocket.
func (*SignalMessage) Marshal ¶
func (t *SignalMessage) Marshal()
Marshal populates the op field from the id field
func (*SignalMessage) Unmarshal ¶
func (t *SignalMessage) Unmarshal() error
Unmarshal sets the id field from the op field
type SignalMessageType ¶
type SignalMessageType int
SignalMessageType represents the types of signal messages
func (SignalMessageType) String ¶
func (t SignalMessageType) String() string
String - returns the string value
type WebRTCService ¶
type WebRTCService struct {
// contains filtered or unexported fields
}
WebRTCService server implementation
func CreateNewWebRTCService ¶
func CreateNewWebRTCService(webRTCConfig *configs.WebRTCConfig, logger hclog.Logger) (*WebRTCService, error)
CreateNewWebRTCService creates a new webrtc server instance
func (*WebRTCService) CreatePlaybackConnection ¶
func (svc *WebRTCService) CreatePlaybackConnection(client *PeerClient) error
CreatePlaybackConnection creates a new webrtc peer connection on the server for recording and streaming playback.
func (*WebRTCService) CreateRecordingConnection ¶
func (svc *WebRTCService) CreateRecordingConnection(client *PeerClient) error
CreateRecordingConnection creates a new webrtc peer connection on the server for recording and streaming playback.
func (*WebRTCService) HasRecordings ¶
func (svc *WebRTCService) HasRecordings() bool
HasRecordings returns true if there is at least one recording available for playback.