package shell

import (
	"fmt"
	"notabug.org/Umnik/GoAndroidSDK/v2/componets/executor"
	"os/exec"
)

// StartVideo creates video in mp4 format and saves it in fileName
func (d DeviceShell) StartVideo(h, w, Mbps int, bugreport bool, fileName string) (*exec.Cmd, error) {
	bg := ""
	if bugreport {
		bg = "--bugreport"
	}
	return executor.RunAsync(d, "screenrecord", "--size", fmt.Sprintf("%dx%d", h, w),
		"--bit-rate", fmt.Sprintf("%dM", Mbps), bg, fileName)
}

// StopVideo stops screen records
func (d DeviceShell) StopVideo(process *exec.Cmd) error {
	return executor.StopAsync(d, process)
}
