低空智控平台 后端go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

61 lines
1.1 KiB

package live
import (
"errors"
"time"
)
var ErrDisabled = errors.New("live provider disabled")
var ErrInvalidConfig = errors.New("live provider configuration invalid")
type Config struct {
Mode string
Provider string
PushDomain string
PlayDomain string
AppName string
AuthKey string
PlayAuthKey string
AuthExpireSeconds int64
PlayURLTTLSeconds int64
Protocol string
SRTPort int
AllowRealCloud bool
}
type StreamRequest struct {
StreamName string
ExpiresAt time.Time
MaxBitrateBps int64
}
type StreamCredentials struct {
Provider string
PushURL string
ExpiresAt time.Time
}
type PlayRequest struct {
StreamName string
ExpiresAt time.Time
}
type PlayURLs struct {
HLS string
FLV string
RTMP string
ExpiresAt time.Time
}
type OnlineStatus struct {
Online bool
BitrateBps int64
ClientCount int
}
type Adapter interface {
Provider() string
CreateStream(req StreamRequest) (StreamCredentials, error)
CreatePlayURLs(req PlayRequest) (PlayURLs, error)
QueryOnline(streamName string) (OnlineStatus, error)
}