streamplayer

package
v0.0.0-...-3a81c59 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: CC0-1.0 Imports: 25 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	CtxKeyStreamPlayer = types.CtxKeyStreamPlayer
)

Variables

This section is empty.

Functions

func StreamID2Title

func StreamID2Title(streamSourceID streamtypes.StreamSourceID) string

func Title2StreamID

func Title2StreamID(title string) streamtypes.StreamSourceID

Types

type Config

type Config = types.Config

type CtxKey

type CtxKey = types.CtxKey

type ErrNilPlayer

type ErrNilPlayer struct{}

func (ErrNilPlayer) Error

func (e ErrNilPlayer) Error() string

type ErrNotImplemented

type ErrNotImplemented struct{}

func (ErrNotImplemented) Error

func (e ErrNotImplemented) Error() string

type FuncNotifyStart

type FuncNotifyStart = types.FuncNotifyStart

type Option

type Option = types.Option

type Options

type Options = types.Options

type PlayerManager

type PlayerManager interface {
	SupportedBackends() []player.Backend
	NewPlayer(
		ctx context.Context,
		title string,
		backend player.Backend,
		opts ...player.Option,
	) (player.Player, error)
}

type Publisher

type Publisher interface {
	ClosedChan() <-chan struct{} // TODO: can I remove this?
}

type RetryablePlayer

type RetryablePlayer struct {
	Player player.Player
}

func (*RetryablePlayer) Close

func (p *RetryablePlayer) Close(ctx context.Context) error

func (*RetryablePlayer) EndChan

func (p *RetryablePlayer) EndChan(ctx context.Context) (<-chan struct{}, error)

func (*RetryablePlayer) GetAudioPosition

func (p *RetryablePlayer) GetAudioPosition(ctx context.Context) (time.Duration, error)

func (*RetryablePlayer) GetAudioTracks

func (p *RetryablePlayer) GetAudioTracks(ctx context.Context) (player.AudioTracks, error)

func (*RetryablePlayer) GetCachedDuration

func (p *RetryablePlayer) GetCachedDuration(ctx context.Context) (time.Duration, error)

func (*RetryablePlayer) GetLength

func (p *RetryablePlayer) GetLength(ctx context.Context) (time.Duration, error)
func (p *RetryablePlayer) GetLink(ctx context.Context) (string, error)

func (*RetryablePlayer) GetPause

func (p *RetryablePlayer) GetPause(ctx context.Context) (bool, error)

func (*RetryablePlayer) GetPosition

func (p *RetryablePlayer) GetPosition(ctx context.Context) (time.Duration, error)

func (*RetryablePlayer) GetSpeed

func (p *RetryablePlayer) GetSpeed(ctx context.Context) (float64, error)

func (*RetryablePlayer) GetSubtitlesTracks

func (p *RetryablePlayer) GetSubtitlesTracks(ctx context.Context) (player.SubtitlesTracks, error)

func (*RetryablePlayer) GetVideoTracks

func (p *RetryablePlayer) GetVideoTracks(ctx context.Context) (player.VideoTracks, error)

func (*RetryablePlayer) IsEnded

func (p *RetryablePlayer) IsEnded(ctx context.Context) (bool, error)

func (*RetryablePlayer) OpenURL

func (p *RetryablePlayer) OpenURL(ctx context.Context, link string) error

func (*RetryablePlayer) ProcessTitle

func (p *RetryablePlayer) ProcessTitle(ctx context.Context) (string, error)

func (*RetryablePlayer) Seek

func (p *RetryablePlayer) Seek(ctx context.Context, pos time.Duration, isRelative bool, quick bool) error

func (*RetryablePlayer) SetAudioTrack

func (p *RetryablePlayer) SetAudioTrack(ctx context.Context, aid int64) error

func (*RetryablePlayer) SetPause

func (p *RetryablePlayer) SetPause(ctx context.Context, pause bool) error

func (*RetryablePlayer) SetSpeed

func (p *RetryablePlayer) SetSpeed(ctx context.Context, speed float64) error

func (*RetryablePlayer) SetSubtitlesTrack

func (p *RetryablePlayer) SetSubtitlesTrack(ctx context.Context, sid int64) error

func (*RetryablePlayer) SetVideoTrack

func (p *RetryablePlayer) SetVideoTrack(ctx context.Context, vid int64) error

func (*RetryablePlayer) SetupForStreaming

func (p *RetryablePlayer) SetupForStreaming(ctx context.Context) error

func (*RetryablePlayer) Stop

func (p *RetryablePlayer) Stop(ctx context.Context) error

type StreamPlayer

type StreamPlayer struct {
	PlayerLocker   xsync.Mutex
	Player         player.Player
	StreamSourceID streamtypes.StreamSourceID
	Backend        player.Backend
	Config         Config

	WantSpeedAverage         *indicator.MAMA[float64]
	CurrentJitterBufDuration time.Duration
}

type StreamPlayerHandler

type StreamPlayerHandler struct {
	StreamPlayer
	Parent *StreamPlayers
	Cancel context.CancelFunc

	CurrentVideoTrackID int
	CurrentAudioTrackID int

	NextVideoTrackID      int
	NextVideoTrackIDCount int
}

func (*StreamPlayerHandler) Close

func (p *StreamPlayerHandler) Close() error

func (*StreamPlayerHandler) GetProtocol

func (p *StreamPlayerHandler) GetProtocol(
	ctx context.Context,
) streamtypes.ServerType

func (*StreamPlayerHandler) Resetup

func (p *StreamPlayerHandler) Resetup(opts ...Option)

func (*StreamPlayerHandler) SetJitterBuffer

func (p *StreamPlayerHandler) SetJitterBuffer(
	ctx context.Context,
	size time.Duration,
	seekToOptimum bool,
) (_err error)

type StreamPlayers

type StreamPlayers struct {
	StreamPlayersLocker xsync.RWMutex
	StreamPlayers       map[streamtypes.StreamSourceID]*StreamPlayerHandler

	StreamServer   StreamServer
	PlayerManager  PlayerManager
	DefaultOptions Options
}

func New

func New(
	streamServer StreamServer,
	playerManager PlayerManager,
	defaultOptions ...Option,
) *StreamPlayers

func (*StreamPlayers) Create

func (sp *StreamPlayers) Create(
	ctx context.Context,
	streamSourceID streamtypes.StreamSourceID,
	backend player.Backend,
	opts ...Option,
) (_ret *StreamPlayerHandler, _err error)

func (*StreamPlayers) Get

func (*StreamPlayers) GetAll

func (*StreamPlayers) Remove

func (sp *StreamPlayers) Remove(
	ctx context.Context,
	streamSourceID streamtypes.StreamSourceID,
) error

type WaitPublisherChaner

type WaitPublisherChaner interface {
	WaitPublisherChan(
		ctx context.Context,
		streamSourceID streamtypes.StreamSourceID,
		waitForNext bool,
	) (<-chan Publisher, error)
}

Directories

Path Synopsis
cmd
streamplayer command

Jump to

Keyboard shortcuts

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