ffmpeg-playout/playout/playout.go

36 lines
599 B
Go

package playout
import (
"fmt"
"log"
"time"
)
type PlayoutType int
const (
rtmpPlayout PlayoutType = iota
icecastPlayout
)
type Job struct {
PlayoutType PlayoutType
StartAt time.Time
StopAt time.Time
Source string
Output string
ControlChannel chan string
}
func (p *Job) Playout() {
// TODO delete playout Job from store after finishing/aborting playout
log.Println(time.Until(p.StartAt))
select {
case ctrlMsg := <-p.ControlChannel:
fmt.Println(ctrlMsg)
return
case <-time.After(time.Until(p.StartAt)):
log.Println("Start Playout")
}
}