2024-10-25 00:51:49 -04:00
|
|
|
package streamer
|
|
|
|
|
2024-10-29 05:11:14 -04:00
|
|
|
import "live-streamer/model"
|
2024-10-25 00:51:49 -04:00
|
|
|
|
|
|
|
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 {
|
2024-10-29 05:11:14 -04:00
|
|
|
Response chan []model.VideoItem
|
2024-10-25 00:51:49 -04:00
|
|
|
}
|
|
|
|
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" }
|