Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HlsWebSocketPublisher ¶
type HlsWebSocketPublisher struct {
// Configuration
Config HlsWebSocketPublisherConfiguration
// contains filtered or unexported fields
}
HLS WebSocket publisher client
func NewHlsWebSocketPublisher ¶
func NewHlsWebSocketPublisher(config HlsWebSocketPublisherConfiguration) *HlsWebSocketPublisher
Creates a new instance of HlsWebSocketPublisher Receives the configuration as the only parameter
func (*HlsWebSocketPublisher) Close ¶
func (pub *HlsWebSocketPublisher) Close()
Finish the publisher This sends the CLOSE message and terminates the connection
func (*HlsWebSocketPublisher) IsClosed ¶
func (publisher *HlsWebSocketPublisher) IsClosed() bool
Checks if the publisher is closed
func (*HlsWebSocketPublisher) SendFragment ¶
func (pub *HlsWebSocketPublisher) SendFragment(duration float32, data []byte)
type HlsWebSocketPublisherConfiguration ¶
type HlsWebSocketPublisherConfiguration struct {
// Server URL
ServerUrl string
// Function to get the server URL
// If set, ServerUrl is ignored
GetServerUrl func() string
// ID of the stream to publish
StreamId string
// Secret to generate authentication tokens
AuthSecret string
// Max length of the queue to keep fragments
// if they cannot be sent to the server immediately
// (10 by default)
QueueMaxLength int
// Function to be called when the publisher is ready
OnReady func()
// Function called on connection or authentication error
// Receives the server URL and the error message
OnError func(url string, msg string)
// Delay to retry the connection after an error
// Default: 1 second
ConnectionRetryDelay time.Duration
}
Configuration for the publisher client
type WebsocketProtocolMessage ¶
type WebsocketProtocolMessage struct {
// Message type
MessageType string
// Message parameters
Parameters map[string]string
}
Websocket protocol message
func ParseWebsocketProtocolMessage ¶
func ParseWebsocketProtocolMessage(str string) *WebsocketProtocolMessage
Parses websocket protocol message from string
func (*WebsocketProtocolMessage) GetParameter ¶
func (msg *WebsocketProtocolMessage) GetParameter(param string) string
Gets the parameter value
func (*WebsocketProtocolMessage) Serialize ¶
func (msg *WebsocketProtocolMessage) Serialize() string
Serializes message to string (to be sent)
Click to show internal directories.
Click to hide internal directories.