models

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

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

func HasValidEvents(events []EventType) bool

HasValidEvents will verify that all the events provided are valid. This is not a efficient method.

Types

type BaseAPIResponse

type BaseAPIResponse struct {
	Message string `json:"message"`
	Success bool   `json:"success"`
}

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

func GenerateClientFromRequest(req *http.Request) Client

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 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 CustomEmoji

type CustomEmoji struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

CustomEmoji represents an image that can be used in chat as a custom emoji.

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"
	// 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 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 IPAddress added in v0.0.12

type IPAddress struct {
	CreatedAt time.Time `json:"createdAt"`
	IPAddress string    `json:"ipAddress"`
	Notes     string    `json:"notes"`
}

IPAddress is a simple representation of an IP address.

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 StreamKey added in v0.1.0

type StreamKey struct {
	Key     string `json:"key"`
	Comment string `json:"comment"`
}

StreamKey represents a single stream key.

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 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

type Variant struct {
	Segments     map[string]*Segment
	VariantIndex int
}

Variant represents a single video variant and the segments that make it up.

func (*Variant) GetSegmentForFilename

func (v *Variant) GetSegmentForFilename(filename string) *Segment

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

func GenerateViewerFromRequest(req *http.Request) Viewer

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL