vidplayer

package
v1.0.1-ni Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadRequest = errors.New("ErrBadRequest")
View Source
var ErrHLS = errors.New("ErrHLS")
View Source
var ErrNotFound = errors.New("ErrNotFound")
View Source
var ErrRTMP = errors.New("ErrRTMP")
View Source
var ErrTimeout = errors.New("ErrTimeout")
View Source
var PlaylistWaittime = 6 * time.Second

Functions

This section is empty.

Types

type VidPlayer

type VidPlayer struct {
	RtmpServer *joy4rtmp.Server

	VodPath string
	// contains filtered or unexported fields
}

VidPlayer is the module that handles playing video. For now we only support RTMP and HLS play.

func NewVidPlayer

func NewVidPlayer(rtmpS *joy4rtmp.Server, vodPath string, mux *http.ServeMux) *VidPlayer

NewVidPlayer creates a new video player

func (*VidPlayer) HandleHLSPlay

func (s *VidPlayer) HandleHLSPlay(
	getMasterPlaylist func(url *url.URL) (*m3u8.MasterPlaylist, error),
	getMediaPlaylist func(url *url.URL) (*m3u8.MediaPlaylist, error),
	getSegment func(url *url.URL) ([]byte, error))

HandleHLSPlay is the handler when there is a HLS video request. It supports both VOD and live streaming.

func (*VidPlayer) HandleRTMPPlay

func (s *VidPlayer) HandleRTMPPlay(getStream func(url *url.URL) (stream.RTMPVideoStream, error)) error

HandleRTMPPlay is the handler when there is a RTMP request for a video. The source should write into the MuxCloser. The easiest way is through avutil.Copy.

Jump to

Keyboard shortcuts

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