diff --git a/record.go b/record.go index ff980a8..68fabf2 100644 --- a/record.go +++ b/record.go @@ -44,24 +44,15 @@ type RecordToggleCmd struct{} // size = 0x0 // Run executes the command to toggle recording. func (cmd *RecordToggleCmd) Run(ctx *context) error { - // Check if recording is in progress - status, err := ctx.Client.Record.GetRecordStatus() + status, err := ctx.Client.Record.ToggleRecord() if err != nil { return err } if status.OutputActive { - _, err = ctx.Client.Record.StopRecord() - if err != nil { - return err - } - fmt.Fprintln(ctx.Out, "Recording stopped successfully.") - } else { - _, err = ctx.Client.Record.StartRecord() - if err != nil { - return err - } fmt.Fprintln(ctx.Out, "Recording started successfully.") + } else { + fmt.Fprintln(ctx.Out, "Recording stopped successfully.") } return nil } diff --git a/stream.go b/stream.go index f34a964..0d01610 100644 --- a/stream.go +++ b/stream.go @@ -41,19 +41,15 @@ type StreamToggleCmd struct{} // size = 0x0 // Run executes the command to toggle streaming. func (cmd *StreamToggleCmd) Run(ctx *context) error { - status, err := ctx.Client.Stream.GetStreamStatus() + status, err := ctx.Client.Stream.ToggleStream() if err != nil { return err } + if status.OutputActive { - _, err = ctx.Client.Stream.StopStream() - fmt.Fprintf(ctx.Out, "Stopping stream...\n") + fmt.Fprintln(ctx.Out, "Streaming started successfully.") } else { - _, err = ctx.Client.Stream.StartStream() - fmt.Fprintf(ctx.Out, "Starting stream...\n") - } - if err != nil { - return err + fmt.Fprintln(ctx.Out, "Streaming stopped successfully.") } return nil }