Skip to content

Commit

Permalink
wip do command
Browse files Browse the repository at this point in the history
  • Loading branch information
seanavery committed Aug 23, 2024
1 parent 9475cee commit d6a280f
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions cam/cam.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ type filteredVideo struct {

workers rdkutils.StoppableWorkers

enc *encoder
seg *segmenter
enc *encoder
seg *segmenter
player *Player

Check failure on line 60 in cam/cam.go

View workflow job for this annotation

GitHub Actions / quality-checks

undefined: Player

Check failure on line 60 in cam/cam.go

View workflow job for this annotation

GitHub Actions / quality-checks

undefined: Player

mu sync.Mutex
triggers map[string]bool
Expand Down Expand Up @@ -184,6 +185,8 @@ func newFilteredVideo(
return nil, err
}

fv.player = newPlayer(logger)

Check failure on line 188 in cam/cam.go

View workflow job for this annotation

GitHub Actions / quality-checks

undefined: newPlayer (typecheck)

Check failure on line 188 in cam/cam.go

View workflow job for this annotation

GitHub Actions / quality-checks

undefined: newPlayer) (typecheck)

watcher, err := fsnotify.NewWatcher()
if err != nil {
return nil, err
Expand Down Expand Up @@ -237,6 +240,25 @@ func (fv *filteredVideo) DoCommand(_ context.Context, command map[string]interfa
}
switch cmd {
case "start":

// { "command": "start", "from": "2021-08-01T00:00:00Z", "to": "2021-08-01T00:00:00Z" }
// vlaidate from and to exist
if _, ok := command["from"]; !ok {
return nil, errors.New("from time not found")
}
if _, ok := command["to"]; !ok {
return nil, errors.New("to time not found")
}
// convert from and to to time.Time
from, err := time.Parse(time.RFC3339, command["from"].(string))
if err != nil {
return nil, err
}
to, err := time.Parse(time.RFC3339, command["to"].(string))
if err != nil {
return nil, err
}
fv.player.start(from, to)
fv.logger.Info("starting video player")
case "pause":
fv.logger.Info("pausing video player")
Expand Down

0 comments on commit d6a280f

Please sign in to comment.