Documentation
¶
Index ¶
- func GetAllSocialHandles() map[string]SocialHandle
- func GetLatencyConfigs() map[int]LatencyLevel
- func HasValidEvents(events []EventType) bool
- type BaseAPIResponse
- type Broadcaster
- type Client
- type ConnectedClientsResponse
- type CurrentBroadcast
- type CustomEmoji
- type EventType
- type ExternalAction
- type InboundStreamDetails
- type LatencyLevel
- type PingMessage
- type RTMPStreamMetadata
- type S3
- type Segment
- type SocialHandle
- type Stats
- type Status
- type StorageProvider
- type StreamOutputVariant
- type UserJoinedEvent
- type Variant
- type Webhook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllSocialHandles ¶
func GetAllSocialHandles() map[string]SocialHandle
GetAllSocialHandles will return a list of all the social platforms we support.
func GetLatencyConfigs ¶
func GetLatencyConfigs() map[int]LatencyLevel
GetLatencyConfigs will return the available latency level options.
func HasValidEvents ¶
HasValidEvents will verify that all the events provided are valid. This is not a efficient method.
Types ¶
type BaseAPIResponse ¶
BaseAPIResponse is a simple response to API requests.
type Broadcaster ¶
type Broadcaster struct {
RemoteAddr string `json:"remoteAddr"`
StreamDetails InboundStreamDetails `json:"streamDetails"`
Time time.Time `json:"time"`
}
Broadcaster represents the details around the inbound broadcasting connection.
type Client ¶
type Client struct {
ConnectedAt time.Time `json:"connectedAt"`
LastSeen time.Time `json:"-"`
MessageCount int `json:"messageCount"`
UserAgent string `json:"userAgent"`
IPAddress string `json:"ipAddress"`
Username *string `json:"username"`
ClientID string `json:"clientID"`
Geo *geoip.GeoDetails `json:"geo"`
}
Client represents a single chat client.
func GenerateClientFromRequest ¶
GenerateClientFromRequest will return a chat client from a http request.
type ConnectedClientsResponse ¶
type ConnectedClientsResponse struct {
Clients []Client `json:"clients"`
}
ConnectedClientsResponse is the response of the currently connected chat clients.
type CurrentBroadcast ¶
type CurrentBroadcast struct {
OutputSettings []StreamOutputVariant `json:"outputSettings"`
LatencyLevel LatencyLevel `json:"latencyLevel"`
}
CurrentBroadcast represents the configuration associated with the currently active stream.
type CustomEmoji ¶
CustomEmoji represents an image that can be used in chat as a custom emoji.
type EventType ¶
type EventType = string
EventType is the type of a websocket event.
const ( // MessageSent is the event sent when a chat event takes place. MessageSent EventType = "CHAT" // UserJoined is the event sent when a chat user join action takes place. UserJoined EventType = "USER_JOINED" // UserNameChanged is the event sent when a chat username change takes place. UserNameChanged EventType = "NAME_CHANGE" // VisibiltyToggled is the event sent when a chat message's visibility changes. VisibiltyToggled EventType = "VISIBILITY-UPDATE" // PING is a ping message. PING EventType = "PING" // PONG is a pong message. PONG EventType = "PONG" // StreamStarted represents a stream started event. StreamStarted EventType = "STREAM_STARTED" // StreamStopped represents a stream stopped event. StreamStopped EventType = "STREAM_STOPPED" // SystemMessageSent is the event sent when a system message is sent. SystemMessageSent EventType = "SYSTEM" // ChatActionSent is a generic chat action that can be used for anything that doesn't need specific handling or formatting. ChatActionSent EventType = "CHAT_ACTION" )
type ExternalAction ¶
type ExternalAction struct {
// URL is the URL to load.
URL string `json:"url"`
// Title is the name of this action, displayed in the modal.
Title string `json:"title"`
// Description is the description of this action.
Description string `json:"description"`
// Icon is the optional icon for the button associated with this action.
Icon string `json:"icon"`
// Color is the optional color for the button associated with this action.
Color string `json:"color"`
// OpenExternally states if the action should open a new tab/window instead of an internal modal.
OpenExternally bool `json:"openExternally"`
}
ExternalAction is a link that will open as a 3rd party action.
type InboundStreamDetails ¶
type InboundStreamDetails struct {
Width int `json:"width"`
Height int `json:"height"`
VideoFramerate float32 `json:"framerate"`
VideoBitrate int `json:"videoBitrate"`
VideoCodec string `json:"videoCodec"`
AudioBitrate int `json:"audioBitrate"`
AudioCodec string `json:"audioCodec"`
Encoder string `json:"encoder"`
VideoOnly bool `json:"-"`
}
InboundStreamDetails represents an inbound broadcast stream.
type LatencyLevel ¶
type LatencyLevel struct {
Level int `json:"level"`
SecondsPerSegment int `json:"-"`
SegmentCount int `json:"-"`
}
LatencyLevel is a representation of HLS configuration values.
func GetLatencyLevel ¶
func GetLatencyLevel(index int) LatencyLevel
GetLatencyLevel will return the latency level at index.
type PingMessage ¶
type PingMessage struct {
MessageType EventType `json:"type"`
}
PingMessage represents a ping message between the client and server.
type RTMPStreamMetadata ¶
type RTMPStreamMetadata struct {
Width int `json:"width"`
Height int `json:"height"`
VideoBitrate float32 `json:"videodatarate"`
VideoCodec interface{} `json:"videocodecid"`
VideoFramerate float32 `json:"framerate"`
AudioBitrate float32 `json:"audiodatarate"`
AudioCodec interface{} `json:"audiocodecid"`
Encoder string `json:"encoder"`
}
RTMPStreamMetadata is the raw metadata that comes in with a RTMP connection.
type S3 ¶
type S3 struct {
Enabled bool `json:"enabled"`
Endpoint string `json:"endpoint,omitempty"`
ServingEndpoint string `json:"servingEndpoint,omitempty"`
AccessKey string `json:"accessKey,omitempty"`
Secret string `json:"secret,omitempty"`
Bucket string `json:"bucket,omitempty"`
Region string `json:"region,omitempty"`
ACL string `json:"acl,omitempty"`
}
S3 is the storage configuration.
type Segment ¶
type Segment struct {
VariantIndex int // The bitrate variant
FullDiskPath string // Where it lives on disk
RelativeUploadPath string // Path it should have remotely
RemoteURL string
}
Segment represents a segment of the live stream.
type SocialHandle ¶
type SocialHandle struct {
Platform string `yaml:"platform" json:"platform,omitempty"`
URL string `yaml:"url" json:"url,omitempty"`
Icon string `json:"icon,omitempty"`
}
SocialHandle represents an external link.
func GetSocialHandle ¶
func GetSocialHandle(platform string) *SocialHandle
GetSocialHandle will return the details for a supported platform.
type Stats ¶
type Stats struct {
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"`
StreamConnected bool `json:"-"`
LastConnectTime *utils.NullTime `json:"-"`
ChatClients map[string]Client `json:"-"`
Viewers map[string]time.Time `json:"-"`
}
Stats holds the stats for the system.
type Status ¶
type Status struct {
Online bool `json:"online"`
ViewerCount int `json:"viewerCount"`
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
LastConnectTime *utils.NullTime `json:"lastConnectTime"`
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"`
VersionNumber string `json:"versionNumber"`
StreamTitle string `json:"streamTitle"`
}
Status represents the status of the system.
type StorageProvider ¶
type StorageProvider interface {
Setup() error
Save(filePath string, retryCount int) (string, error)
SegmentWritten(localFilePath string)
VariantPlaylistWritten(localFilePath string)
MasterPlaylistWritten(localFilePath string)
}
StorageProvider is how a chunk storage provider should be implemented.
type StreamOutputVariant ¶
type StreamOutputVariant struct {
// Name is an optional human-readable label for this stream output.
Name string `json:"name"`
// Enable passthrough to copy the video and/or audio directly from the
// incoming stream and disable any transcoding. It will ignore any of
// the below settings.
IsVideoPassthrough bool `yaml:"videoPassthrough" json:"videoPassthrough"`
IsAudioPassthrough bool `yaml:"audioPassthrough" json:"audioPassthrough"`
VideoBitrate int `yaml:"videoBitrate" json:"videoBitrate"`
AudioBitrate int `yaml:"audioBitrate" json:"audioBitrate"`
// Set only one of these in order to keep your current aspect ratio.
// Or set neither to not scale the video.
ScaledWidth int `yaml:"scaledWidth" json:"scaledWidth,omitempty"`
ScaledHeight int `yaml:"scaledHeight" json:"scaledHeight,omitempty"`
Framerate int `yaml:"framerate" json:"framerate"`
// CPUUsageLevel represents a codec preset to configure CPU usage.
CPUUsageLevel int `json:"cpuUsageLevel"`
}
StreamOutputVariant defines the output specifics of a single HLS stream variant.
func (*StreamOutputVariant) GetFramerate ¶
func (q *StreamOutputVariant) GetFramerate() int
GetFramerate returns the framerate or default.
func (*StreamOutputVariant) GetIsAudioPassthrough ¶
func (q *StreamOutputVariant) GetIsAudioPassthrough() bool
GetIsAudioPassthrough will return if this variant audio is passthrough.
func (*StreamOutputVariant) GetName ¶
func (q *StreamOutputVariant) GetName() string
GetName will return the human readable name for this stream output.
func (*StreamOutputVariant) MarshalJSON ¶
func (q *StreamOutputVariant) MarshalJSON() ([]byte, error)
MarshalJSON is a custom JSON marshal function for video stream qualities.
type UserJoinedEvent ¶
type UserJoinedEvent struct {
Username string `json:"username"`
Type EventType `json:"type"`
ID string `json:"id"`
Timestamp time.Time `json:"timestamp,omitempty"`
}
UserJoinedEvent represents an event when a user joins the chat.
type Variant ¶
Variant represents a single video variant and the segments that make it up.
func (*Variant) GetSegmentForFilename ¶
GetSegmentForFilename gets the segment for the provided filename.
type Webhook ¶
type Webhook struct {
ID int `json:"id"`
URL string `json:"url"`
Events []EventType `json:"events"`
Timestamp time.Time `json:"timestamp"`
LastUsed *time.Time `json:"lastUsed"`
}
Webhook is an event that is sent to 3rd party, external services with details about something that took place within an Owncast server.