live-streamer/streamer/message.go
2024-10-29 17:11:14 +08:00

44 lines
1.4 KiB
Go
Executable File

package streamer
import "live-streamer/model"
type Message interface {
messageType() string
}
type StartMessage struct{}
type StopMessage struct{}
type AddVideoMessage struct {
Path string
}
type RemoveVideoMessage struct {
Path string
}
type NextVideoMessage struct{}
type PrevVideoMessage struct{}
type GetCurrentVideoMessage struct {
Response chan string
}
type GetVideoListMessage struct {
Response chan []model.VideoItem
}
type GetVideoListPathMessage struct {
Response chan []string
}
type GetCurrentIndexMessage struct {
Response chan int
}
type CloseMessage struct{}
func (m StartMessage) messageType() string { return "start" }
func (m StopMessage) messageType() string { return "stop" }
func (m AddVideoMessage) messageType() string { return "add" }
func (m RemoveVideoMessage) messageType() string { return "remove" }
func (m NextVideoMessage) messageType() string { return "next" }
func (m PrevVideoMessage) messageType() string { return "prev" }
func (m GetCurrentVideoMessage) messageType() string { return "getCurrentVideo" }
func (m GetVideoListMessage) messageType() string { return "getVideoList" }
func (m GetVideoListPathMessage) messageType() string { return "getVideoListPath" }
func (m GetCurrentIndexMessage) messageType() string { return "getCurrentIndex" }
func (m CloseMessage) messageType() string { return "close" }