streaming

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: GPL-3.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const InitSegmentIdx = -1

Variables

View Source
var PBSManager, _ = NewPlaybackSessionManager()

Functions

func AddM3U8Header added in v0.3.3

func AddM3U8Header(next http.Handler) http.Handler

For Apple devices to handle HLS properly, the m3u8 playlists must be sent with the correct Content-Type

func RegisterRoutes added in v0.1.1

func RegisterRoutes(router *mux.Router)

RegisterRoutes registers streaming routes to an existing router

Types

type Error

type Error interface {
	error
	Status() int
}

Error represents a handler error. It provides methods for a HTTP status code and embeds the built-in error interface.

type PlaybackSession

type PlaybackSession struct {
	PlaybackSessionKey

	TranscodingSession *ffmpeg.TranscodingSession
	// contains filtered or unexported fields
}

func NewPlaybackSession

func NewPlaybackSession(playbackSessionKey PlaybackSessionKey, segmentIdx int, m *PlaybackSessionManager) (*PlaybackSession, error)

func (*PlaybackSession) CleanupIfRequired

func (s *PlaybackSession) CleanupIfRequired()

func (*PlaybackSession) Release

func (s *PlaybackSession) Release()

type PlaybackSessionKey

type PlaybackSessionKey struct {
	ffmpeg.StreamKey
	// contains filtered or unexported fields
}

type PlaybackSessionManager added in v0.4.0

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

func NewPlaybackSessionManager added in v0.4.0

func NewPlaybackSessionManager() (m *PlaybackSessionManager, cleanup func())

func (*PlaybackSessionManager) CleanupSessions added in v0.4.0

func (m *PlaybackSessionManager) CleanupSessions()

Cleanup cleans up any streaming artifacts that might be left.

func (*PlaybackSessionManager) GetPlaybackSession added in v0.4.0

func (m *PlaybackSessionManager) GetPlaybackSession(
	playbackSessionKey PlaybackSessionKey,
	segmentIdx int) (*PlaybackSession, error)

GetPlaybackSession gets a playback session with the given key and for the given segment index. If the segment index is too far in the future, it will conclude that the user likely skipped ahead and start a new playback session. If segmentIdx == InitSegmentIdx, any session will be returned for the given (StreamKey, representationID). This is useful to get a session to serve the init segment from because it doesn't matter where ffmpeg seeked to, the init segment will always be the same. The returned PlaybackSession must be released after use by calling ReleasePlaybackSession.

func (*PlaybackSessionManager) GetPlaybackSessionByID added in v0.4.0

func (m *PlaybackSessionManager) GetPlaybackSessionByID(playbackSessionID string) (*PlaybackSession, error)

GetPlaybackSessionByID gets the playback session by its ID. If one with the given ID does not exist, and error is returned. The returned PlaybackSession must be released after use by calling ReleasePlaybackSession.

func (*PlaybackSessionManager) GetPlaybackSessions added in v0.4.0

func (m *PlaybackSessionManager) GetPlaybackSessions() map[PlaybackSessionKey]*PlaybackSession

type StatusError

type StatusError struct {
	Code int
	Err  error
}

StatusError represents an error with an associated HTTP status code.

func (StatusError) Error

func (se StatusError) Error() string

Allows StatusError to satisfy the error interface.

func (StatusError) Status

func (se StatusError) Status() int

Returns our HTTP status code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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