stream

package
v0.0.0-...-4c68550 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLobbyNotActive = errors.New("lobby not active")
View Source
var ErrSpaceNotFound = errors.New("reading unknown space in store")
View Source
var ErrStreamNotFound = errors.New("reading unknown live stream from store")

Functions

This section is empty.

Types

type LiveLobbyService

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

func NewLiveLobbyService

func NewLiveLobbyService(store storage, lobbyManager liveLobbyManager) *LiveLobbyService

func (*LiveLobbyService) CloseLobbyHostConnection

func (s *LiveLobbyService) CloseLobbyHostConnection(ctx context.Context, stream *LiveStream, instanceId uuid.UUID) (bool, error)

CloseLobbyHostConnection Deprecated: Because the Endpoint API is getting simpler

func (*LiveLobbyService) CreateLobbyEgressEndpoint

func (s *LiveLobbyService) CreateLobbyEgressEndpoint(ctx context.Context, sdp *webrtc.SessionDescription, stream *LiveStream, userId uuid.UUID) (*webrtc.SessionDescription, string, error)

func (*LiveLobbyService) CreateLobbyHostIngressConnection

func (s *LiveLobbyService) CreateLobbyHostIngressConnection(ctx context.Context, offer *webrtc.SessionDescription, stream *LiveStream, instanceId uuid.UUID) (*webrtc.SessionDescription, string, error)

CreateLobbyHostIngressConnection Deprecated: Because the Endpoint API is getting simpler

func (*LiveLobbyService) CreateLobbyHostPipeConnection

func (s *LiveLobbyService) CreateLobbyHostPipeConnection(ctx context.Context, offer *webrtc.SessionDescription, stream *LiveStream, instanceId uuid.UUID) (*webrtc.SessionDescription, string, error)

CreateLobbyHostPipeConnection Deprecated: Because the Endpoint API is getting simpler

func (*LiveLobbyService) CreateLobbyIngressEndpoint

func (s *LiveLobbyService) CreateLobbyIngressEndpoint(ctx context.Context, sdp *webrtc.SessionDescription, stream *LiveStream, userId uuid.UUID) (*webrtc.SessionDescription, string, error)

func (*LiveLobbyService) CreateMainStreamLobbyEgressEndpoint

func (s *LiveLobbyService) CreateMainStreamLobbyEgressEndpoint(ctx context.Context, offer *webrtc.SessionDescription, stream *LiveStream, userId uuid.UUID) (*webrtc.SessionDescription, error)

CreateMainStreamLobbyEgressEndpoint Deprecated: Because the Endpoint API is getting simpler

func (*LiveLobbyService) FinalCreateLobbyEgressEndpoint

func (s *LiveLobbyService) FinalCreateLobbyEgressEndpoint(ctx context.Context, offer *webrtc.SessionDescription, stream *LiveStream, userId uuid.UUID) (bool, error)

FinalCreateLobbyEgressEndpoint Deprecated: Because the Endpoint API is getting simpler

func (*LiveLobbyService) InitLobbyEgressEndpoint

func (s *LiveLobbyService) InitLobbyEgressEndpoint(ctx context.Context, stream *LiveStream, userId uuid.UUID) (*webrtc.SessionDescription, error)

InitLobbyEgressEndpoint Deprecated: Because the Endpoint API is getting simpler

func (*LiveLobbyService) LeaveLobby

func (s *LiveLobbyService) LeaveLobby(ctx context.Context, stream *LiveStream, userId uuid.UUID) (bool, error)

func (*LiveLobbyService) StartLiveStream

func (s *LiveLobbyService) StartLiveStream(ctx context.Context, stream *LiveStream, streamInfo *LiveStreamInfo, userId uuid.UUID) error

func (*LiveLobbyService) StopLiveStream

func (s *LiveLobbyService) StopLiveStream(ctx context.Context, stream *LiveStream, userId uuid.UUID) error

type LiveStream

type LiveStream struct {
	VideoId   string             `json:"-" gorm:"not null;"`
	Video     *models.Video      `json:"-" gorm:"foreignKey:VideoId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	UUID      uuid.UUID          `json:"uuid"`
	Title     string             `json:"title" gorm:"-"`
	LobbyId   uint               `json:"-" gorm:"not null;"`
	Lobby     *lobby.LobbyEntity `json:"-" gorm:"foreignKey:LobbyId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	SpaceId   uint               `json:"-" gorm:"not null;"`
	Space     *Space             `json:"-" gorm:"foreignKey:SpaceId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	AccountId uint               `json:"-" gorm:"not null;"`
	Account   *auth.Account      `json:"-" gorm:"foreignKey:AccountId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	User      string             `json:"user"`
	ID        uint               `json:"-" gorm:"primaryKey"`
	CreatedAt time.Time          `json:"-"`
	UpdatedAt time.Time          `json:"-"`
	DeletedAt gorm.DeletedAt     `json:"-" gorm:"index"`
}

type LiveStreamInfo

type LiveStreamInfo struct {
	StreamKey string `json:"streamKey"`
	RtmpUrl   string `json:"rtmpUrl"`
}

type LiveStreamRepository

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

func NewLiveStreamRepository

func NewLiveStreamRepository(store storage) *LiveStreamRepository

func (*LiveStreamRepository) Add

func (r *LiveStreamRepository) Add(ctx context.Context, liveStream *LiveStream) (string, error)

func (*LiveStreamRepository) AllBySpaceIdentifier

func (r *LiveStreamRepository) AllBySpaceIdentifier(ctx context.Context, identifier string) ([]LiveStream, error)

func (*LiveStreamRepository) BuildGuestAccounts

func (r *LiveStreamRepository) BuildGuestAccounts(ctx context.Context, actors []*models.Actor)

func (*LiveStreamRepository) Contains

func (r *LiveStreamRepository) Contains(ctx context.Context, streamUUID string) bool

func (*LiveStreamRepository) Delete

func (r *LiveStreamRepository) Delete(ctx context.Context, streamUUID string) error

func (*LiveStreamRepository) DeleteByUuid

func (r *LiveStreamRepository) DeleteByUuid(ctx context.Context, streamUUID string) error

func (*LiveStreamRepository) FindByUuid

func (r *LiveStreamRepository) FindByUuid(ctx context.Context, streamUUID string) (*LiveStream, error)

func (*LiveStreamRepository) Len

func (*LiveStreamRepository) Update

func (r *LiveStreamRepository) Update(ctx context.Context, stream *LiveStream) error

func (*LiveStreamRepository) UpsertLiveStream

func (r *LiveStreamRepository) UpsertLiveStream(ctx context.Context, stream *LiveStream) error

type LiveStreamService

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

func NewLiveStreamService

func NewLiveStreamService(repo *LiveStreamRepository, spaceRepo *SpaceRepository) *LiveStreamService

func (*LiveStreamService) AllBySpaceIdentifier

func (ls *LiveStreamService) AllBySpaceIdentifier(ctx context.Context, identifier string) ([]LiveStream, error)

func (*LiveStreamService) CreateStream

func (ls *LiveStreamService) CreateStream(ctx context.Context, liveStream *LiveStream, identifier string, user string) (string, error)

func (*LiveStreamService) CreateStreamAccessByVideo

func (ls *LiveStreamService) CreateStreamAccessByVideo(ctx context.Context, video *models.Video) error

func (*LiveStreamService) Delete

func (ls *LiveStreamService) Delete(ctx context.Context, uuid string, user string) error

func (*LiveStreamService) DeleteStreamAccessByVideo

func (ls *LiveStreamService) DeleteStreamAccessByVideo(ctx context.Context, iri string) error

func (*LiveStreamService) FindByUuidAndSpaceIdentifier

func (ls *LiveStreamService) FindByUuidAndSpaceIdentifier(ctx context.Context, uuid string, identifier string) (*LiveStream, error)

func (*LiveStreamService) UpdateStream

func (ls *LiveStreamService) UpdateStream(ctx context.Context, liveStream *LiveStream, identifier string, user string) error

func (*LiveStreamService) UpdateStreamAccessByVideo

func (ls *LiveStreamService) UpdateStreamAccessByVideo(ctx context.Context, video *models.Video) error

type LiveStreamStatus

type LiveStreamStatus struct {
	Status LiveStreamStatusValue `json:"status"`
}

type LiveStreamStatusValue

type LiveStreamStatusValue int
const (
	LiveStreamStatusOnline LiveStreamStatusValue = iota + 1
	LiveStreamStatusOffline
)

type Space

type Space struct {
	Identifier string        `gorm:"not null;unique;"`
	ChannelId  uint          `json:"-" gorm:"not null"`
	Channel    *models.Actor `json:"-" gorm:"foreignKey:ChannelId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	AccountId  uint          `json:"-" gorm:"not null;"`
	Account    *auth.Account `json:"-" gorm:"foreignKey:AccountId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	gorm.Model
}

type SpaceManager

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

func NewSpaceManager

func NewSpaceManager(store storage) *SpaceManager

func (*SpaceManager) GetSpace

func (m *SpaceManager) GetSpace(ctx context.Context, identifier string) (*Space, error)

type SpaceRepository

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

func NewSpaceRepository

func NewSpaceRepository(store storage) *SpaceRepository

func (*SpaceRepository) Add

func (r *SpaceRepository) Add(ctx context.Context, space *Space) (string, error)

func (*SpaceRepository) CreateWithIdentifier

func (r *SpaceRepository) CreateWithIdentifier(ctx context.Context, identifier string) (*Space, error)

func (*SpaceRepository) Delete

func (r *SpaceRepository) Delete(ctx context.Context, identifier string) error

func (*SpaceRepository) GetByIdentifier

func (r *SpaceRepository) GetByIdentifier(ctx context.Context, identifier string) (*Space, error)

func (*SpaceRepository) Len

func (r *SpaceRepository) Len(ctx context.Context) int64

Jump to

Keyboard shortcuts

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