54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package event
|
|
|
|
type Name string
|
|
|
|
const (
|
|
EventNameDestinationAdded Name = "destination_added"
|
|
EventNameDestinationRemoved Name = "destination_removed"
|
|
EventNameMediaServerStarted Name = "media_server_started"
|
|
EventNameFatalErrorOccurred Name = "fatal_error_occurred"
|
|
)
|
|
|
|
type Event interface {
|
|
name() Name
|
|
}
|
|
|
|
// DestinationAddedEvent is emitted when a destination is successfully added.
|
|
type DestinationAddedEvent struct {
|
|
URL string
|
|
}
|
|
|
|
func (e DestinationAddedEvent) name() Name {
|
|
return EventNameDestinationAdded
|
|
}
|
|
|
|
// DestinationRemovedEvent is emitted when a destination is successfully
|
|
// removed.
|
|
type DestinationRemovedEvent struct {
|
|
URL string
|
|
}
|
|
|
|
func (e DestinationRemovedEvent) name() Name {
|
|
return EventNameDestinationRemoved
|
|
}
|
|
|
|
// MediaServerStartedEvent is emitted when the mediaserver component starts successfully.
|
|
type MediaServerStartedEvent struct {
|
|
RTMPURL string
|
|
RTMPSURL string
|
|
}
|
|
|
|
func (e MediaServerStartedEvent) name() Name {
|
|
return "media_server_started"
|
|
}
|
|
|
|
// FatalErrorOccurredEvent is emitted when a fatal application
|
|
// error occurs.
|
|
type FatalErrorOccurredEvent struct {
|
|
Message string
|
|
}
|
|
|
|
func (e FatalErrorOccurredEvent) name() Name {
|
|
return "fatal_error_occurred"
|
|
}
|