Documentation
¶
Index ¶
- Constants
- func GetAllSocialHandles() map[string]SocialHandle
- func GetLatencyConfigs() map[int]LatencyLevel
- func HasValidEvents(events []EventType) bool
- type AuthType
- type BaseAPIResponse
- type Broadcaster
- type BrowserNotificationConfiguration
- type Client
- type ConfigEntry
- func (c *ConfigEntry) GetBool() (bool, error)
- func (c *ConfigEntry) GetDecoder() *gob.Decoder
- func (c *ConfigEntry) GetNumber() (float64, error)
- func (c *ConfigEntry) GetObject(result interface{}) error
- func (c *ConfigEntry) GetString() (string, error)
- func (c *ConfigEntry) GetStringMap() (map[string]string, error)
- func (c *ConfigEntry) GetStringSlice() ([]string, error)
- type ConnectedClientsResponse
- type CurrentBroadcast
- type DiscordConfiguration
- type EventType
- type ExternalAPIUser
- type ExternalAction
- type FederatedActivity
- type Follower
- type InboundStreamDetails
- type LatencyLevel
- type PingMessage
- type RTMPStreamMetadata
- type S3
- type Segment
- type SocialHandle
- type Stats
- type Status
- type StorageProvider
- type StreamHealthOverview
- type StreamOutputVariant
- type User
- type UserJoinedEvent
- type Variant
- type Viewer
- type Webhook
Constants ¶
const ( // ScopeCanSendChatMessages will allow sending chat messages as itself. ScopeCanSendChatMessages = "CAN_SEND_MESSAGES" // ScopeCanSendSystemMessages will allow sending chat messages as the system. ScopeCanSendSystemMessages = "CAN_SEND_SYSTEM_MESSAGES" // ScopeHasAdminAccess will allow performing administrative actions on the server. ScopeHasAdminAccess = "HAS_ADMIN_ACCESS" ModeratorScopeKey = "MODERATOR" )
Variables ¶
This section is empty.
Functions ¶
func GetAllSocialHandles ¶ added in v0.0.6
func GetAllSocialHandles() map[string]SocialHandle
GetAllSocialHandles will return a list of all the social platforms we support.
func GetLatencyConfigs ¶ added in v0.0.6
func GetLatencyConfigs() map[int]LatencyLevel
GetLatencyConfigs will return the available latency level options.
func HasValidEvents ¶ added in v0.0.6
HasValidEvents will verify that all the events provided are valid. This is not a efficient method.
Types ¶
type AuthType ¶ added in v0.2.0
type AuthType string
Type represents a form of authentication.
const ( // IndieAuth https://indieauth.spec.indieweb.org/. IndieAuth AuthType = "indieauth" Fediverse AuthType = "fediverse" )
The different auth types we support.
type BaseAPIResponse ¶
BaseAPIResponse is a simple response to API requests.
type Broadcaster ¶
type Broadcaster struct {
Time time.Time `json:"time"`
RemoteAddr string `json:"remoteAddr"`
StreamDetails InboundStreamDetails `json:"streamDetails"`
}
Broadcaster represents the details around the inbound broadcasting connection.
type BrowserNotificationConfiguration ¶ added in v0.0.12
type BrowserNotificationConfiguration struct {
GoLiveMessage string `json:"goLiveMessage,omitempty"`
Enabled bool `json:"enabled"`
}
BrowserNotificationConfiguration represents the configuration for browser notifications.
type Client ¶
type Client struct {
ConnectedAt time.Time `json:"connectedAt"`
LastSeen time.Time `json:"-"`
Username *string `json:"username"`
Geo *geoip.GeoDetails `json:"geo"`
UserAgent string `json:"userAgent"`
IPAddress string `json:"ipAddress"`
ClientID string `json:"clientID"`
MessageCount int `json:"messageCount"`
}
Client represents a single chat client.
func GenerateClientFromRequest ¶
GenerateClientFromRequest will return a chat client from a http request.
type ConfigEntry ¶ added in v0.2.0
type ConfigEntry struct {
Value interface{}
Key string
}
ConfigEntry is the actual object saved to the database. The Value is encoded using encoding/gob.
func (*ConfigEntry) GetBool ¶ added in v0.2.0
func (c *ConfigEntry) GetBool() (bool, error)
func (*ConfigEntry) GetDecoder ¶ added in v0.2.0
func (c *ConfigEntry) GetDecoder() *gob.Decoder
func (*ConfigEntry) GetNumber ¶ added in v0.2.0
func (c *ConfigEntry) GetNumber() (float64, error)
func (*ConfigEntry) GetObject ¶ added in v0.2.0
func (c *ConfigEntry) GetObject(result interface{}) error
func (*ConfigEntry) GetString ¶ added in v0.2.0
func (c *ConfigEntry) GetString() (string, error)
func (*ConfigEntry) GetStringMap ¶ added in v0.2.0
func (c *ConfigEntry) GetStringMap() (map[string]string, error)
func (*ConfigEntry) GetStringSlice ¶ added in v0.2.0
func (c *ConfigEntry) GetStringSlice() ([]string, error)
type ConnectedClientsResponse ¶
type ConnectedClientsResponse struct {
Clients []Client `json:"clients"`
}
ConnectedClientsResponse is the response of the currently connected chat clients.
type CurrentBroadcast ¶ added in v0.0.6
type CurrentBroadcast struct {
OutputSettings []StreamOutputVariant `json:"outputSettings"`
LatencyLevel LatencyLevel `json:"latencyLevel"`
}
CurrentBroadcast represents the configuration associated with the currently active stream.
type DiscordConfiguration ¶ added in v0.0.12
type DiscordConfiguration struct {
Webhook string `json:"webhook,omitempty"`
GoLiveMessage string `json:"goLiveMessage,omitempty"`
Enabled bool `json:"enabled"`
}
DiscordConfiguration represents the configuration for the discord notification service.
type EventType ¶ added in v0.0.6
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" // UserParted is the event sent when a chat user parted action takes place. UserParted EventType = "USER_PARTED" // UserNameChanged is the event sent when a chat username change takes place. UserNameChanged EventType = "NAME_CHANGE" // FediverseEngagementFollow is the event sent when a user follows the stream. FediverseEngagementFollow EventType = "FEDIVERSE_ENGAGEMENT_FOLLOW" // 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" // StreamTitleUpdated is the event sent when a stream's title changes. StreamTitleUpdated EventType = "STREAM_TITLE_UPDATED" // 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 ExternalAPIUser ¶ added in v0.2.0
type ExternalAPIUser struct {
CreatedAt time.Time `json:"createdAt"`
LastUsedAt *time.Time `json:"lastUsedAt,omitempty"`
ID string `json:"id"`
AccessToken string `json:"accessToken"`
DisplayName string `json:"displayName"`
Type string `json:"type,omitempty"` // Should be API
Scopes []string `json:"scopes"`
DisplayColor int `json:"displayColor"`
IsBot bool `json:"isBot"`
}
ExternalAPIUser represents a single 3rd party integration that uses an access token. This struct mostly matches the User struct so they can be used interchangeably.
type ExternalAction ¶ added in v0.0.7
type ExternalAction struct {
// URL is the URL to load.
URL string `json:"url"`
// HTML is the HTML to embed into the modal. When this is set, OpenExternally and URL are ignored
HTML string `json:"html"`
// 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 FederatedActivity ¶ added in v0.0.11
type FederatedActivity struct {
Timestamp time.Time `json:"timestamp"`
IRI string `json:"iri"`
ActorIRI string `json:"actorIRI"`
Type string `json:"type"`
}
FederatedActivity is an internal representation of an activity that was accepted and stored.
type Follower ¶ added in v0.0.11
type Follower struct {
// ActorIRI is the IRI of the remote actor.
ActorIRI string `json:"link"`
// Inbox is the inbox URL of the remote follower
Inbox string `json:"-"`
// Name is the display name of the follower.
Name string `json:"name"`
// Username is the account username of the remote actor.
Username string `json:"username"`
// Image is the avatar image of the follower.
Image string `json:"image"`
// Timestamp is when this follow request was created.
Timestamp utils.NullTime `json:"timestamp,omitempty"`
// DisabledAt is when this follower was rejected or disabled.
DisabledAt utils.NullTime `json:"disabledAt,omitempty"`
}
Follower is our internal representation of a single follower within Owncast.
type InboundStreamDetails ¶
type InboundStreamDetails struct {
VideoCodec string `json:"videoCodec"`
AudioCodec string `json:"audioCodec"`
Encoder string `json:"encoder"`
Width int `json:"width"`
Height int `json:"height"`
VideoBitrate int `json:"videoBitrate"`
AudioBitrate int `json:"audioBitrate"`
VideoFramerate float32 `json:"framerate"`
VideoOnly bool `json:"-"`
}
InboundStreamDetails represents an inbound broadcast stream.
type LatencyLevel ¶ added in v0.0.6
type LatencyLevel struct {
Level int `json:"level"`
SecondsPerSegment int `json:"-"`
SegmentCount int `json:"-"`
}
LatencyLevel is a representation of HLS configuration values.
func GetLatencyLevel ¶ added in v0.0.6
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 {
VideoCodec interface{} `json:"videocodecid"`
AudioCodec interface{} `json:"audiocodecid"`
Encoder string `json:"encoder"`
Width int `json:"width"`
Height int `json:"height"`
VideoBitrate float32 `json:"videodatarate"`
VideoFramerate float32 `json:"framerate"`
AudioBitrate float32 `json:"audiodatarate"`
}
RTMPStreamMetadata is the raw metadata that comes in with a RTMP connection.
type S3 ¶ added in v0.0.6
type S3 struct {
Endpoint string `json:"endpoint,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"`
// PathPrefix is an optional prefix for object storage.
PathPrefix string `json:"pathPrefix,omitempty"`
// This property is no longer used as of v0.1.1. See the standalone
// property that was pulled out of here instead. It's only left here
// to allow the migration to take place without data loss.
ServingEndpoint string `json:"-"`
Enabled bool `json:"enabled"`
ForcePathStyle bool `json:"forcePathStyle"`
}
S3 is the storage configuration.
type Segment ¶
type Segment struct {
FullDiskPath string // Where it lives on disk
RelativeUploadPath string // Path it should have remotely
RemoteURL string
VariantIndex int // The bitrate variant
}
Segment represents a segment of the live stream.
type SocialHandle ¶ added in v0.0.6
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 ¶ added in v0.0.6
func GetSocialHandle(platform string) *SocialHandle
GetSocialHandle will return the details for a supported platform.
type Stats ¶
type Stats struct {
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"`
LastConnectTime *utils.NullTime `json:"-"`
ChatClients map[string]Client `json:"-"`
Viewers map[string]*Viewer `json:"-"`
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
StreamConnected bool `json:"-"`
}
Stats holds the stats for the system.
type Status ¶
type Status struct {
LastConnectTime *utils.NullTime `json:"lastConnectTime"`
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"`
VersionNumber string `json:"versionNumber"`
StreamTitle string `json:"streamTitle"`
ViewerCount int `json:"viewerCount"`
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
Online bool `json:"online"`
}
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)
Cleanup() error
}
StorageProvider is how a chunk storage provider should be implemented.
type StreamHealthOverview ¶ added in v0.0.12
type StreamHealthOverview struct {
Message string `json:"message"`
HealthyPercentage int `json:"healthPercentage"`
Representation int `json:"representation"`
Healthy bool `json:"healthy"`
}
StreamHealthOverview represents an overview of the current stream health.
type StreamOutputVariant ¶ added in v0.0.6
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 ¶ added in v0.0.6
func (q *StreamOutputVariant) GetFramerate() int
GetFramerate returns the framerate or default.
func (*StreamOutputVariant) GetIsAudioPassthrough ¶ added in v0.0.6
func (q *StreamOutputVariant) GetIsAudioPassthrough() bool
GetIsAudioPassthrough will return if this variant audio is passthrough.
func (*StreamOutputVariant) GetName ¶ added in v0.0.7
func (q *StreamOutputVariant) GetName() string
GetName will return the human readable name for this stream output.
func (*StreamOutputVariant) MarshalJSON ¶ added in v0.0.6
func (q *StreamOutputVariant) MarshalJSON() ([]byte, error)
MarshalJSON is a custom JSON marshal function for video stream qualities.
type User ¶ added in v0.2.0
type User struct {
CreatedAt time.Time `json:"createdAt"`
DisabledAt *time.Time `json:"disabledAt,omitempty"`
NameChangedAt *time.Time `json:"nameChangedAt,omitempty"`
AuthenticatedAt *time.Time `json:"-"`
ID string `json:"id"`
DisplayName string `json:"displayName"`
PreviousNames []string `json:"previousNames"`
Scopes []string `json:"scopes,omitempty"`
DisplayColor int `json:"displayColor"`
IsBot bool `json:"isBot"`
Authenticated bool `json:"authenticated"`
}
func (*User) IsModerator ¶ added in v0.2.0
IsModerator will return if the user has moderation privileges.
type UserJoinedEvent ¶ added in v0.0.6
type UserJoinedEvent struct {
Timestamp time.Time `json:"timestamp,omitempty"`
Username string `json:"username"`
Type EventType `json:"type"`
ID string `json:"id"`
}
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 Viewer ¶ added in v0.0.12
type Viewer struct {
FirstSeen time.Time `json:"firstSeen"`
LastSeen time.Time `json:"-"`
Geo *geoip.GeoDetails `json:"geo"`
UserAgent string `json:"userAgent"`
IPAddress string `json:"ipAddress"`
ClientID string `json:"clientID"`
}
Viewer represents a single video viewer.
func GenerateViewerFromRequest ¶ added in v0.0.12
GenerateViewerFromRequest will return a chat client from a http request.
type Webhook ¶ added in v0.0.6
type Webhook struct {
Timestamp time.Time `json:"timestamp"`
LastUsed *time.Time `json:"lastUsed"`
URL string `json:"url"`
Events []EventType `json:"events"`
ID int `json:"id"`
}
Webhook is an event that is sent to 3rd party, external services with details about something that took place within an Owncast server.
Source Files
¶
- auth.go
- baseAPIResponse.go
- broadcaster.go
- chatAccessScopes.go
- client.go
- configEntry.go
- currentBroadcast.go
- eventType.go
- externalAPIUser.go
- externalAction.go
- federatedActivity.go
- follower.go
- latencyLevels.go
- notification.go
- pingMessage.go
- playlist.go
- s3Storage.go
- socialHandle.go
- stats.go
- status.go
- storageProvider.go
- streamHealth.go
- streamOutputVariant.go
- user.go
- userJoinedEvent.go
- viewer.go
- webhook.go