live-streamer/websocket/websocket.go
nite07 6093f5d36b fix: cannot parse input config
mod: set gin release mode
fix: input item start and end args not work
fix: cannot auto play next video
2024-10-24 22:29:03 +08:00

36 lines
744 B
Go

package websocket
import (
"live-streamer/streamer"
)
type RequestType string
const (
TypeStreamNextVideo RequestType = "StreamNextVideo"
TypeStreamPrevVideo RequestType = "StreamPrevVideo"
TypeQuit RequestType = "Quit"
)
type Request struct {
Type RequestType `json:"type"`
}
type Date struct {
Timestamp int64 `json:"timestamp"`
CurrentVideoPath string `json:"currentVideoPath"`
VideoList []string `json:"videoList"`
Output string `json:"output"`
}
func RequestHandler(reqType RequestType) {
switch reqType {
case TypeStreamNextVideo:
streamer.GlobalStreamer.Next()
case TypeStreamPrevVideo:
streamer.GlobalStreamer.Prev()
case TypeQuit:
streamer.GlobalStreamer.Close()
}
}