nite07
6093f5d36b
mod: set gin release mode fix: input item start and end args not work fix: cannot auto play next video
36 lines
744 B
Go
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()
|
|
}
|
|
}
|