live-streamer/websocket/websocket.go
nite07 dfdb6003ea feat: log level config
feat: ffmpeg args placeholder
2024-10-29 03:35:21 +08:00

36 lines
744 B
Go
Executable File

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()
}
}