Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blackmagic hyperdeck recording #190

Merged
Prev Previous commit
Next Next commit
added recording
thatnerdjack committed Jun 26, 2024
commit 8d8162151e9e9876b0a282813aaf14cfae267113
23 changes: 22 additions & 1 deletion field/arena.go
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import (
"fmt"
"log"
"math"
"net"
"reflect"
"time"

@@ -459,6 +460,7 @@ func (arena *Arena) AbortMatch() error {
arena.AudienceDisplayModeNotifier.Notify()
arena.AllianceStationDisplayMode = "logo"
arena.AllianceStationDisplayModeNotifier.Notify()
arena.stopRecording()
return nil
}

@@ -548,6 +550,7 @@ func (arena *Arena) Update() {
arena.AudienceDisplayModeNotifier.Notify()
arena.AllianceStationDisplayMode = "match"
arena.AllianceStationDisplayModeNotifier.Notify()
arena.startRecording()
if game.MatchTiming.WarmupDurationSec > 0 {
arena.MatchState = WarmupPeriod
enabled = false
@@ -599,6 +602,7 @@ func (arena *Arena) Update() {
auto = false
enabled = false
sendDsPacket = true
arena.stopRecording()
go func() {
// Leave the scores on the screen briefly at the end of the match.
time.Sleep(time.Second * matchEndScoreDwellSec)
@@ -1090,5 +1094,22 @@ func (arena *Arena) runPeriodicTasks() {

// Starts recording using configured, on-network Blackmagic Device
func (arena *Arena) startRecording() {
//code
conn, err := net.Dial("tcp", fmt.Sprintln("%s:%d", arena.EventSettings.RecorderAddress, arena.EventSettings.RecorderPort))
if err != nil {
//todo: actually error on screen in some way? Ask pat for advice here.
fmt.Println("error: ", err)
}

fmt.Fprint(conn, "record\n")
}

// Stops recording using configured, on-network Blackmagic Device
func (arena *Arena) stopRecording() {
conn, err := net.Dial("tcp", fmt.Sprintln("%s:%d", arena.EventSettings.RecorderAddress, arena.EventSettings.RecorderPort))
if err != nil {
//todo: actually error on screen in some way? Ask pat for advice here.
fmt.Println("error: ", err)
}

fmt.Fprint(conn, "stop\n")
}