Back to

Package videoserver

Latest Go to latest

The highest tagged major version is .

Published: Oct 12, 2020 | License: MIT | Module:



var (
	// ErrStreamNotFound When map of streams doesn't contain requested key
	ErrStreamNotFound = fmt.Errorf("Stream not found for provided ID")

func HLSWrapper

func HLSWrapper(app *Application) func(ctx *gin.Context)

HLSWrapper Returns HLS handler (static files)

func ListWrapper

func ListWrapper(app *Application) func(ctx *gin.Context)

ListWrapper Returns list of streams

func StatusWrapper

func StatusWrapper(app *Application) func(ctx *gin.Context)

StatusWrapper Returns statuses for list of streams

func WebSocketWrapper

func WebSocketWrapper(app *Application, wsUpgrader *websocket.Upgrader) func(ctx *gin.Context)

WebSocketWrapper Returns WS handler

type Application

type Application struct {
	Server          *ServerInfo  `json:"server"`
	Streams         StreamsMap   `json:"streams"`
	HlsMsPerSegment int64        `json:"hls_ms_per_segment"`
	HlsDirectory    string       `json:"hls_directory"`
	HlsWindowSize   uint         `json:"hls_window_size"`
	HlsCapacity     uint         `json:"hls_window_capacity"`
	CorsConfig      *cors.Config `json:"-"`

Application Configuration parameters for application

func NewApplication

func NewApplication(cfg *ConfigurationArgs) (*Application, error)

NewApplication Prepare configuration for application

func (*Application) StartHTTPServer

func (app *Application) StartHTTPServer()

StartHTTPServer Initialize http server and run it

func (*Application) StartStreams

func (app *Application) StartStreams()

StartStreams Start video streams

type ConfigurationArgs

type ConfigurationArgs struct {
	Server          ServerConfiguration `json:"server"`
	Streams         []StreamArg         `json:"streams"`
	HlsMsPerSegment int64               `json:"hls_ms_per_segment"`
	HlsDirectory    string              `json:"hls_directory"`
	HlsWindowSize   uint                `json:"hls_window_size"`
	HlsCapacity     uint                `json:"hls_window_capacity"`
	CorsConfig      CorsConfiguration   `json:"cors_config"`

ConfigurationArgs Configuration parameters for application as JSON-file

func NewConfiguration

func NewConfiguration(fname string) (*ConfigurationArgs, error)

NewConfiguration Constructor for ConfigurationArgs

type CorsConfiguration

type CorsConfiguration struct {
	UseCORS          bool     `json:"use_cors"`
	AllowOrigins     []string `json:"allow_origins"`
	AllowMethods     []string `json:"allow_methods"`
	AllowHeaders     []string `json:"allow_headers"`
	ExposeHeaders    []string `json:"expose_headers"`
	AllowCredentials bool     `json:"allow_credentials"`

CorsConfiguration Configuration of CORS requests

type ServerConfiguration

type ServerConfiguration struct {
	HTTPAddr string `json:"http_addr"`
	HTTPPort int    `json:"http_port"`

ServerConfiguration Configuration parameters for server

type ServerInfo

type ServerInfo struct {
	HTTPAddr string `json:"http_addr"`
	HTTPPort int    `json:"http_port"`

ServerInfo Information about server

type StreamArg

type StreamArg struct {
	GUID        string   `json:"guid"`
	URL         string   `json:"url"`
	StreamTypes []string `json:"stream_types"`

StreamArg Infromation about stream's source

type StreamConfiguration

type StreamConfiguration struct {
	URL                  string   `json:"url"`
	Status               bool     `json:"status"`
	SupportedStreamTypes []string `json:"supported_stream_types"`
	Codecs               []av.CodecData
	Clients              map[uuid.UUID]viewer
	// contains filtered or unexported fields

StreamConfiguration Configuration parameters for stream

type StreamsMap

type StreamsMap struct {
	Streams map[uuid.UUID]*StreamConfiguration

StreamsMap Map wrapper for map[uuid.UUID]*StreamConfiguration with mutex for concurrent usage

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier