Documentation ¶
Index ¶
- Constants
- Variables
- func AddM3U8Header(next http.Handler) http.Handler
- func RegisterRoutes(router *mux.Router)
- type Error
- type PlaybackSession
- type PlaybackSessionKey
- type PlaybackSessionManager
- func (m *PlaybackSessionManager) CleanupSessions()
- func (m *PlaybackSessionManager) GetPlaybackSession(playbackSessionKey PlaybackSessionKey, segmentIdx int) (*PlaybackSession, error)
- func (m *PlaybackSessionManager) GetPlaybackSessionByID(playbackSessionID string) (*PlaybackSession, error)
- func (m *PlaybackSessionManager) GetPlaybackSessions() map[PlaybackSessionKey]*PlaybackSession
- type StatusError
Constants ¶
const InitSegmentIdx = -1
Variables ¶
var PBSManager, _ = NewPlaybackSessionManager()
Functions ¶
func AddM3U8Header ¶ added in v0.3.3
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
RegisterRoutes registers streaming routes to an existing router
Types ¶
type Error ¶
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 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 ¶
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.