When the publisher or source of a stream is offline, the server can be configured to fill gaps in the stream with a video that is played on repeat until a publisher comes back online. This allows readers to stay connected regardless of the state of the stream. The offline video and any future online stream are concatenated without decoding or re-encoding packets, using the original codec.
40 lines
831 B
Go
40 lines
831 B
Go
package conf
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/bluenviron/mediamtx/internal/conf/jsonwrapper"
|
|
)
|
|
|
|
// AuthMethod is an authentication method.
|
|
type AuthMethod string
|
|
|
|
// authentication methods.
|
|
const (
|
|
AuthMethodInternal AuthMethod = "internal"
|
|
AuthMethodHTTP AuthMethod = "http"
|
|
AuthMethodJWT AuthMethod = "jwt"
|
|
)
|
|
|
|
// UnmarshalJSON implements json.Unmarshaler.
|
|
func (d *AuthMethod) UnmarshalJSON(b []byte) error {
|
|
type alias AuthMethod
|
|
if err := jsonwrapper.Unmarshal(b, (*alias)(d)); err != nil {
|
|
return err
|
|
}
|
|
|
|
switch *d {
|
|
case AuthMethodInternal, AuthMethodHTTP, AuthMethodJWT:
|
|
|
|
default:
|
|
return fmt.Errorf("invalid authMethod: '%s'", *d)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// UnmarshalEnv implements env.Unmarshaler.
|
|
func (d *AuthMethod) UnmarshalEnv(_ string, v string) error {
|
|
return d.UnmarshalJSON([]byte(`"` + v + `"`))
|
|
}
|