fix: screen record with scrcpy

This commit is contained in:
lilong.129
2025-03-06 17:50:01 +08:00
parent cc81c00a82
commit 79e0323471
4 changed files with 50 additions and 11 deletions
+13 -3
View File
@@ -127,9 +127,10 @@ func WithScreenShotFileName(fileName string) ActionOption {
}
type ScreenRecordOptions struct {
ScreenRecordDuration float64 `json:"screenrecord_duration,omitempty" yaml:"screenrecord_duration,omitempty"`
ScreenRecordWithAudio bool `json:"screenrecord_with_audio,omitempty" yaml:"screenrecord_with_audio,omitempty"`
ScreenRecordPath string `json:"screenrecord_path,omitempty" yaml:"screenrecord_path,omitempty"`
ScreenRecordDuration float64 `json:"screenrecord_duration,omitempty" yaml:"screenrecord_duration,omitempty"`
ScreenRecordWithAudio bool `json:"screenrecord_with_audio,omitempty" yaml:"screenrecord_with_audio,omitempty"`
ScreenRecordWithScrcpy bool `json:"screenrecord_with_scrcpy,omitempty" yaml:"screenrecord_with_scrcpy,omitempty"`
ScreenRecordPath string `json:"screenrecord_path,omitempty" yaml:"screenrecord_path,omitempty"`
}
func (o *ScreenRecordOptions) GetScreenRecordOptions() []ActionOption {
@@ -145,6 +146,9 @@ func (o *ScreenRecordOptions) GetScreenRecordOptions() []ActionOption {
if o.ScreenRecordWithAudio {
options = append(options, WithScreenRecordAudio(true))
}
if o.ScreenRecordWithScrcpy {
options = append(options, WithScreenRecordScrcpy(true))
}
if o.ScreenRecordPath != "" {
options = append(options, WithScreenRecordPath(o.ScreenRecordPath))
}
@@ -163,6 +167,12 @@ func WithScreenRecordAudio(audioOn bool) ActionOption {
}
}
func WithScreenRecordScrcpy(scrcpyOn bool) ActionOption {
return func(o *ActionOptions) {
o.ScreenRecordWithScrcpy = scrcpyOn
}
}
func WithScreenRecordPath(path string) ActionOption {
return func(o *ActionOptions) {
o.ScreenRecordPath = path