ovenmedia

package
v0.4.75 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//virtual hosts
	V1_HOSTS      = "/v1/vhosts"
	V1_HOSTS_NAME = "/v1/vhosts/%s"
	// PUSH
	// /v1/vhosts/{vhost_name}/apps/{app_name}:startPush
	V1_HOSTS_START_PUSH_NAME = "/v1/vhosts/%s/apps/%s:startPush"
	//
	V1_HOSTS_STOP_PUSH_NAME = "/v1/vhosts/%s/apps/%s:stopPush"
	//http://<OME_HOST>:<API_PORT>/v1/vhosts/{vhost_name}/apps/{app_name}:pushes
	V1_HOSTS_PUSHES_NAME = "/v1/vhosts/%s/apps/%s:pushes"
	//
	// RECORDING
	// http://<OME_HOST>:<API_PORT>/v1/vhosts/{vhost_name}/apps/{app_name}:startRecord
	V1_HOSTS_START_RECORD_NAME = "/v1/vhosts/%s/apps/%s:startRecord"
	//http://<OME_HOST>:<API_PORT>/v1/vhosts/{vhost_name}/apps/{app_name}:stopRecord
	V1_HOSTS_STOP_RECORD_NAME = "/v1/vhosts/%s/apps/%s:stopRecord"
	// http://<OME_HOST>:<API_PORT>/v1/vhosts/{vhost_name}/apps/{app_name}:records
	V1_HOSTS_RECORDS_NAME = "/v1/vhosts/%s/apps/%s:records"
	//
	// STATS
	// http://<OME_HOST>:<API_PORT>/v1/stats/current/vhosts/{vhost_name}
	V1_CURRENT_STATS_NAME = "/v1/stats/current/vhosts/%s"
	// http://<OME_HOST>:<API_PORT>/v1/stats/current/vhosts/{vhost_name}/apps/{app_name}
	V1_CURRENT_STATS_APPP_NAME = "/v1/stats/current/vhosts/%s/apps/%s"
	// http://<OME_HOST>:<API_PORT>/v1/stats/current/vhosts/{vhost_name}/apps/{app_name}/stream/{stream}
	V1_CURRENT_STATS_APPP_STREAMS_NAME = "/v1/stats/current/vhosts/%s/apps/%s/stream/%s"
)

Variables

View Source
var (
	//
	GET_VHOSTS_BY_NAME = func(vhostName string) string {
		return fmt.Sprintf(V1_HOSTS_NAME, vhostName)
	}
	// Get all vhost start push by name
	GET_VHOSTS_PUSH_BY_NAME = func(vhostName string, appName string) string {
		return fmt.Sprintf(V1_HOSTS_START_PUSH_NAME, vhostName, appName)
	}
	// Get all vhost stop by name
	GET_VHOSTS_STOP_BY_NAME = func(vhostName string, appName string) string {

		return fmt.Sprintf(V1_HOSTS_STOP_PUSH_NAME, vhostName, appName)
	}
	//
	GET_VHOSTS_PUSHES_BY_NAME = func(vhostName string, appName string) string {
		return fmt.Sprintf(V1_HOSTS_PUSHES_NAME, vhostName, appName)
	}
	//
	GET_VHOSTS_START_RECORDED_BY_NAME = func(vhostName string, appName string) string {
		return fmt.Sprintf(V1_HOSTS_START_RECORD_NAME, vhostName, appName)
	}
	//
	GET_VHOSTS_STOP_RECORDED_BY_NAME = func(vhostName string, appName string) string {
		return fmt.Sprintf(V1_HOSTS_STOP_RECORD_NAME, vhostName, appName)
	}
	//
	GET_VHOSTS_RECORDS_BY_NAME = func(vhostName string, appName string) string {
		return fmt.Sprintf(V1_HOSTS_RECORDS_NAME, vhostName, appName)
	}
	//
	GET_CURRENT_STATS_NAME = func(vhostName string) string {
		return fmt.Sprintf(V1_CURRENT_STATS_NAME, vhostName)
	}
	//
	GET_CURRENT_STATS_APP_NAME = func(vhostName string, appName string) string {
		return fmt.Sprintf(V1_CURRENT_STATS_APPP_NAME, vhostName, appName)
	}
	//
	GET_CURRENT_STATS_STREAM = func(vhostName string, appName string, stream string) string {
		return fmt.Sprintf(V1_CURRENT_STATS_APPP_STREAMS_NAME, vhostName, appName, stream)
	}
	//
	GET_THUMBNAIL = func(appName string, streamKey string) string {
		return fmt.Sprintf("/%s/%s/thumb.png", appName, streamKey)
	}
)

Functions

This section is empty.

Types

type ApplicationType

type ApplicationType string
const (
	LIVE ApplicationType = "live"
	VOD  ApplicationType = "vod"
)

type Audio added in v0.4.60

type Audio struct {
	Bitrate    string `json:"bitrate"`
	Bypass     bool   `json:"bypass"`
	Channel    int    `json:"channel"`
	Codec      string `json:"codec"`
	Samplerate int    `json:"samplerate"`
}

type AudioLayout

type AudioLayout string
const (
	STEREO AudioLayout = "stereo"
	MONO   AudioLayout = "mono"
)

type BaseResponseOK added in v0.4.42

type BaseResponseOK struct {
	Message    string `json:"message"`
	StatusCode int    `json:"statusCode"`
}

type CodecVideo

type CodecVideo string
const (
	H264 CodecVideo = "h264"
	H265 CodecVideo = "h265"
	VP8  CodecVideo = "vp8"
	OPUS CodecVideo = "opus"
	AAC  CodecVideo = "aac"
)

type HeaderConfigurator added in v0.3.0

type HeaderConfigurator struct {
	Headers map[string]string
}

func InitHeaderConfigurator added in v0.3.0

func InitHeaderConfigurator() *HeaderConfigurator

func (*HeaderConfigurator) CreateBasicAuthHeader added in v0.3.0

func (h *HeaderConfigurator) CreateBasicAuthHeader(username string, password string)

Authorization Stuff

func (*HeaderConfigurator) CreateBasicAuthHeaderEncoded added in v0.3.0

func (h *HeaderConfigurator) CreateBasicAuthHeaderEncoded(base64EncodedToken string)

func (*HeaderConfigurator) CreateOmeBasicAuthHeader added in v0.3.0

func (h *HeaderConfigurator) CreateOmeBasicAuthHeader(username string, password string)

func (*HeaderConfigurator) CreateOmeBasicAuthHeaderEncoded added in v0.3.0

func (h *HeaderConfigurator) CreateOmeBasicAuthHeaderEncoded(base64EncodedToken string)

func (*HeaderConfigurator) CreateOmeBasicAuthHeaderWord added in v0.4.1

func (h *HeaderConfigurator) CreateOmeBasicAuthHeaderWord(word string)

func (*HeaderConfigurator) DeleteHeader added in v0.3.0

func (h *HeaderConfigurator) DeleteHeader(key string)

func (*HeaderConfigurator) DeleteHeaders added in v0.3.0

func (h *HeaderConfigurator) DeleteHeaders()

func (*HeaderConfigurator) GetHeader added in v0.3.0

func (h *HeaderConfigurator) GetHeader(key string) *string

func (*HeaderConfigurator) GetHeaderKeyValuePairs added in v0.3.0

func (h *HeaderConfigurator) GetHeaderKeyValuePairs() map[string]string

func (*HeaderConfigurator) GetHeaderKeys added in v0.3.0

func (h *HeaderConfigurator) GetHeaderKeys() []string

func (*HeaderConfigurator) GetHeaderValues added in v0.3.0

func (h *HeaderConfigurator) GetHeaderValues() []string

func (*HeaderConfigurator) GetHeaders added in v0.3.0

func (h *HeaderConfigurator) GetHeaders() map[string]string

func (*HeaderConfigurator) HasHeader added in v0.3.0

func (h *HeaderConfigurator) HasHeader(key string) bool

func (*HeaderConfigurator) HasHeaders added in v0.3.0

func (h *HeaderConfigurator) HasHeaders() bool

func (*HeaderConfigurator) SetHeader added in v0.3.0

func (h *HeaderConfigurator) SetHeader(key string, value string)

func (*HeaderConfigurator) SetHeaders added in v0.3.0

func (h *HeaderConfigurator) SetHeaders(headers map[string]string)

type IOvenMediaClient

type IOvenMediaClient interface {
	IsDebug() bool
	HealthCheck() error
	// VirtualHost
	CreateVirtualHost(name string) (*ResponseVirtualHost, error)
	GetAllVirtualHosts() (*ResponseVirtualList, error)
	// Application
	GetApplications(host string) (*ResponseVirtualList, error)
	//Stream
	GetStreams(host string, application string) (*ResponseVirtualList, error)
	GetStreamInfo(host string, application string, stream string) (*ResponseStreamInfo, error)
	// Push
	StartPush(vHost string, appName string, body RequestBodyPush) (*ResponseStartPush, error)
	StopPush(vHost string, appName string, body RequestBodyPush) (*resty.Response, error)
	GetAllPushes(vHost string, appName string) (*ResponsePushes, error)
	// Recording
	StartRecording(vHost string, appName string, body RequestRecordingStart) (*ResponseRecordingStart, error)
	StopRecording(vHost string, appName string, body RequestRecordingStop) (*ResponseRecordingStart, error)
	GetRecordingState(vHost string, appName string, body RequestRecordingStop) (*ResponseRecordingStart, error)
	ListRecordingState(vHost string, appName string) (*ResponseRecordingStateList, error)
	// Stats
	GetStatsVhosts(vHost string) (*ResponseStats, error)
	GetStatsAppVhosts(vHost string, appName string) (*ResponseStats, error)
	GetStatsStreamVhosts(vHost string, appName string, stream string) (*ResponseStats, error)
	// Thumbnail
	GetThumbnail(host string, appName string, streamKey string) (*resty.Response, error)
}

func BuildOven

func BuildOven(url string, debug bool, header *HeaderConfigurator) (IOvenMediaClient, error)

type Builder OvenMedia

type MediaType

type MediaType string
const (
	VIDEO MediaType = "video"
	AUDIO MediaType = "audio"
)

type RequestBodyPush added in v0.2.0

type RequestBodyPush struct {
	ID        string       `json:"id" required:"true" validate:"nonnil,min=1"`
	Stream    SimpleStream `json:"stream"`
	Protocol  string       `json:"protocol" required:"true" validate:"nonnil,min=1"`
	URL       string       `json:"url" required:"true" validate:"nonnil,min=1"`
	StreamKey string       `json:"streamKey" required:"true" validate:"nonnil,min=1"`
}

type RequestCreateVirtualHost

type RequestCreateVirtualHost struct {
	VirtualHostsName []VRHostResponse
}

type RequestRecordingStart added in v0.4.42

type RequestRecordingStart struct {
	ID               string       `json:"id" required:"true" validate:"nonnil,min=1"`
	Stream           SimpleStream `json:"stream"`
	FilePath         string       `json:"filePath" required:"true" validate:"nonnil,min=1"`
	InfoPath         string       `json:"infoPath" required:"true" validate:"nonnil,min=1"`
	Interval         *int         `json:"interval,omitempty"`
	Schedule         *string      `json:"schedule,omitempty"`
	SegmentationRule *string      `json:"segmentationRule,omitempty"`
}
{
  "id": "custom_id",
  "stream": {
    "name": "stream_o",
    "tracks": [ 100, 200 ]
  },
  "filePath" : "/path/to/save/recorded/file_${Sequence}.ts",
  "infoPath" : "/path/to/save/information/file.xml",
  "interval" : 60000,    # Split it every 60 seconds
  "schedule" : "0 0 1" # Split it at second 0, minute 0, every hours.
  "segmentationRule" : "continuity"

}

type RequestRecordingStop added in v0.4.42

type RequestRecordingStop struct {
	ID string `json:"id" required:"true" validate:"nonnil,min=1"`
}
{
  "id": "custom_id"
}

type ResponsePush added in v0.2.0

type ResponsePush struct {
	App         string `json:"app"`
	CreatedTime string `json:"createdTime"`
	ID          string `json:"id"`
	Protocol    string `json:"protocol"`
	SentBytes   int    `json:"sentBytes"`
	SentTime    int    `json:"sentTime"`
	Sequence    int    `json:"sequence"`
	StartTime   string `json:"startTime"`
	State       string `json:"state"`
	Stream      struct {
		Name   string `json:"name"`
		Tracks []int  `json:"tracks"`
	} `json:"stream"`
	StreamKey      string `json:"streamKey"`
	TotalSentBytes int    `json:"totalsentBytes"`
	TotalSentTime  int    `json:"totalsentTime"`
	URL            string `json:"url"`
	Vhost          string `json:"vhost"`
}

type ResponsePushes added in v0.4.0

type ResponsePushes struct {
	BaseResponseOK
	Response []struct {
		App         string    `json:"app"`
		CreatedTime time.Time `json:"createdTime"`
		FinishTime  time.Time `json:"finishTime"`
		Id          string    `json:"id"`
		Protocol    string    `json:"protocol"`
		SentBytes   int       `json:"sentBytes"`
		SentTime    int       `json:"sentTime"`
		Sequence    int       `json:"sequence"`
		StartTime   time.Time `json:"startTime"`
		State       string    `json:"state"`
		Stream      struct {
			Name   string `json:"name"`
			Tracks []int  `json:"tracks"`
		} `json:"stream"`
		StreamKey      string `json:"streamKey"`
		TotalsentBytes int    `json:"totalsentBytes"`
		TotalsentTime  int    `json:"totalsentTime"`
		Url            string `json:"url"`
		Vhost          string `json:"vhost"`
	} `json:"response"`
}

type ResponseRecording added in v0.4.42

type ResponseRecording struct {
	State  string `json:"state"`
	ID     string `json:"id"`
	Vhost  string `json:"vhost"`
	App    string `json:"app"`
	Stream struct {
		Name   string `json:"name"`
		Tracks []int  `json:"tracks"`
	} `json:"stream"`
	FilePath         string    `json:"filePath"`
	InfoPath         string    `json:"infoPath"`
	Interval         int       `json:"interval"`
	Schedule         string    `json:"schedule"`
	SegmentationRule string    `json:"segmentationRule"`
	CreatedTime      time.Time `json:"createdTime"`
}

type ResponseRecordingStart added in v0.4.42

type ResponseRecordingStart struct {
	BaseResponseOK
	Response ResponseRecording `json:"response"`
}
{
    "message": "OK",
    "response": [
        {
            "state": "ready",
            "id": "stream_o",
            "vhost": "default",
            "app": "app",
            "stream": {
                "name": "stream_o",
                "tracks": []
            },
            "filePath": "/path/to/save/recorded/file_${Sequence}.ts",
            "infoPath": "/path/to/save/information/file.xml",
            "interval": 60000,
            "schedule": "0 0 *1",
            "segmentationRule": "continuity",
            "createdTime": "2021-08-31T23:44:44.789+0900"
        }
    ],
    "statusCode": 200
}

type ResponseRecordingStateList added in v0.4.72

type ResponseRecordingStateList struct {
	BaseResponseOK
	Response []ResponseRecording `json:"response"`
}

type ResponseStartPush added in v0.3.0

type ResponseStartPush struct {
	BaseResponseOK
	Response ResponsePush `json:"response"`
}

PUSH Stuff

type ResponseStats added in v0.4.41

type ResponseStats struct {
	CreatedTime            string `json:"createdTime"`
	LastRecvTime           string `json:"lastRecvTime"`
	LastSentTime           string `json:"lastSentTime"`
	LastUpdatedTime        string `json:"lastUpdatedTime"`
	MaxTotalConnectionTime string `json:"maxTotalConnectionTime"`
	MaxTotalConnections    int    `json:"maxTotalConnections"`
	TotalBytesIn           int    `json:"totalBytesIn"`
	TotalBytesOut          int    `json:"totalBytesOut"`
	TotalConnections       int    `json:"totalConnections"`
}
{
	"createdTime": "2021-01-11T02:52:22.013+09:00",
	"lastRecvTime": "2021-01-11T04:11:41.734+09:00",
	"lastSentTime": "2021-01-11T02:52:22.013+09:00",
	"lastUpdatedTime": "2021-01-11T04:11:41.734+09:00",
	"maxTotalConnectionTime": "2021-01-11T02:52:22.013+09:00",
	"maxTotalConnections": 0,
	"totalBytesIn": 494713880,
	"totalBytesOut": 0,
	"totalConnections": 0
}

type ResponseStreamInfo added in v0.4.50

type ResponseStreamInfo struct {
	BaseResponseOK
	Response struct {
		Input struct {
			CreatedTime time.Time `json:"createdTime"`
			SourceType  string    `json:"sourceType"`
			SourceUrl   string    `json:"sourceUrl"`
			Tracks      []Track   `json:"tracks"`
		} `json:"input"`
		Name    string `json:"name"`
		Outputs []struct {
			Name   string `json:"name"`
			Tracks []struct {
				Id    int    `json:"id"`
				Name  string `json:"name"`
				Type  string `json:"type"`
				Video struct {
					Bypass    bool    `json:"bypass"`
					Bitrate   string  `json:"bitrate,omitempty"`
					Codec     string  `json:"codec,omitempty"`
					Framerate float64 `json:"framerate,omitempty"`
					Height    int     `json:"height,omitempty"`
					Width     int     `json:"width,omitempty"`
				} `json:"video,omitempty"`
				Audio struct {
					Bypass     bool   `json:"bypass"`
					Bitrate    string `json:"bitrate,omitempty"`
					Channel    int    `json:"channel,omitempty"`
					Codec      string `json:"codec,omitempty"`
					Samplerate int    `json:"samplerate,omitempty"`
				} `json:"audio,omitempty"`
			} `json:"tracks"`
		} `json:"outputs"`
	} `json:"response"`
}

type ResponseVirtualHost

type ResponseVirtualHost struct {
	VRHosts []VirtualHost
}

Response<VirtualHost>

type ResponseVirtualList added in v0.2.0

type ResponseVirtualList struct {
	BaseResponseOK
	Response []string `json:"response"`
}

type SessionState

type SessionState string
const (
	READY    SessionState = "Ready"
	STARTED  SessionState = "Started"
	STOPPING SessionState = "Stopping"
	STOPPED  SessionState = "Stopped"
	ERROR    SessionState = "Error"
)

type SimpleStream added in v0.4.64

type SimpleStream struct {
	Name   string `json:"name"`
	Tracks []int  `json:"tracks"`
}

type Track added in v0.4.60

type Track struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	Type  string `json:"type"`
	Video Video  `json:"video,omitempty"`
	Audio Audio  `json:"audio,omitempty"`
}

type VRHostResponse

type VRHostResponse struct {
	Name string `json:"name"`
}

type Video added in v0.4.60

type Video struct {
	Bitrate   string  `json:"bitrate"`
	Bypass    bool    `json:"bypass"`
	Codec     string  `json:"codec"`
	Framerate float64 `json:"framerate"`
	Height    int     `json:"height"`
	Width     int     `json:"width"`
}

type VirtualHost

type VirtualHost struct {
	BaseResponseOK
	Response VRHostResponse `json:"response"`
}

Jump to

Keyboard shortcuts

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