lives

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(domain string, b Builder)

Types

type BucketSnapshot added in v0.0.5

type BucketSnapshot struct {
	Platform        string    `json:"platform"`
	Capacity        int       `json:"capacity"`
	TokensAvailable int       `json:"tokensAvailable"`
	LastRefillAt    time.Time `json:"lastRefillAt"`
	CurrentUsed     int       `json:"currentUsed"`
}

type Builder

type Builder interface {
	Build(*url.URL) (LiveApi, error)
}

type LiveApi

type LiveApi interface {
	GetInfo() (*LiveState, error)
}

func New

func New(sUrl string) (liveApi LiveApi, err error)

type LiveConfig

type LiveConfig struct {
	Id             int
	RoomUrl        string
	Interval       int
	Format         string
	MonitorType    int
	MonitorStartAt string
	MonitorStopAt  string
	Quality        int
	SegmentTime    int
}

type LiveSession

type LiveSession struct {
	Id              int
	Config          LiveConfig
	State           LiveState
	StartedAt       *gtime.Time
	Filename        string
	LiveApi         LiveApi
	EventDispatcher interfaces.Module
	ListenerManager interfaces.Module
	RecorderManager interfaces.Module
	// contains filtered or unexported fields
}

func NewLiveSession

func NewLiveSession(id int, config LiveConfig, liveAPI LiveApi) *LiveSession

func (*LiveSession) GetState

func (s *LiveSession) GetState() LiveState

func (*LiveSession) UpdateState

func (s *LiveSession) UpdateState(newState LiveState)

type LiveState

type LiveState struct {
	LiveId      int
	RoomName    string
	Anchor      string
	Platform    string
	IsLive      bool
	StreamInfos []*StreamUrlInfo
}

type PlatformBucket added in v0.0.5

type PlatformBucket struct {
	// contains filtered or unexported fields
}

func NewPlatformBucket added in v0.0.5

func NewPlatformBucket(platform string, capacity int) *PlatformBucket

func (*PlatformBucket) Acquire added in v0.0.5

func (b *PlatformBucket) Acquire(ctx context.Context, n int) error

func (*PlatformBucket) TryAcquire added in v0.0.5

func (b *PlatformBucket) TryAcquire(n int) bool

type StreamUrlInfo

type StreamUrlInfo struct {
	Url                  *url.URL
	Name                 string
	Description          string
	IsHls                bool
	Resolution           int
	Vbitrate             int
	HeadersForDownloader map[string]string
}

type TokenBucketManager added in v0.0.5

type TokenBucketManager struct {
	// contains filtered or unexported fields
}

func GetBucketManager added in v0.0.5

func GetBucketManager() *TokenBucketManager

func NewTokenBucketManager added in v0.0.5

func NewTokenBucketManager() *TokenBucketManager

func (*TokenBucketManager) Acquire added in v0.0.5

func (m *TokenBucketManager) Acquire(ctx context.Context, platform string) error

func (*TokenBucketManager) AcquireBatch added in v0.0.5

func (m *TokenBucketManager) AcquireBatch(ctx context.Context, platform string, n int) error

func (*TokenBucketManager) EnsureBucket added in v0.0.5

func (m *TokenBucketManager) EnsureBucket(platform string) *PlatformBucket

func (*TokenBucketManager) Start added in v0.0.5

func (m *TokenBucketManager) Start()

func (*TokenBucketManager) Status added in v0.0.5

func (m *TokenBucketManager) Status() map[string]BucketSnapshot

func (*TokenBucketManager) Stop added in v0.0.5

func (m *TokenBucketManager) Stop()

func (*TokenBucketManager) TryAcquire added in v0.0.5

func (m *TokenBucketManager) TryAcquire(ctx context.Context, platform string) bool

func (*TokenBucketManager) TryAcquireBatch added in v0.0.5

func (m *TokenBucketManager) TryAcquireBatch(ctx context.Context, platform string, n int) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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