Skip to content

Commit b10f521

Browse files
author
Mykola Mokhnach
authored
Add new screen recording options for iOS (#1067)
1 parent 260fa5e commit b10f521

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

src/main/java/io/appium/java_client/ios/IOSStartScreenRecordingOptions.java

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,24 @@ public class IOSStartScreenRecordingOptions
3030
extends BaseStartScreenRecordingOptions<IOSStartScreenRecordingOptions> {
3131
private String videoType;
3232
private String videoQuality;
33+
private String videoScale;
34+
private Integer fps;
3335

3436
public static IOSStartScreenRecordingOptions startScreenRecordingOptions() {
3537
return new IOSStartScreenRecordingOptions();
3638
}
3739

38-
public enum VideoType {
39-
H264, MP4, FMP4
40-
}
41-
4240
/**
43-
* The format of the screen capture to be recorded.
44-
* Available formats: "h264", "mp4" or "fmp4". Default is "mp4".
45-
* Only works for Simulator.
41+
* The video codec type used for encoding of the recorded screen capture.
42+
* Execute `ffmpeg -codecs` in the terminal to see the list of supported video codecs.
43+
* 'mjpeg' by default.
4644
*
47-
* @param videoType one of available format names.
45+
* @since Appium 1.10.0
46+
* @param videoType one of available video codec names, for example 'libx264'.
4847
* @return self instance for chaining.
4948
*/
50-
public IOSStartScreenRecordingOptions withVideoType(VideoType videoType) {
51-
this.videoType = checkNotNull(videoType).name().toLowerCase();
49+
public IOSStartScreenRecordingOptions withVideoType(String videoType) {
50+
this.videoType = checkNotNull(videoType);
5251
return this;
5352
}
5453

@@ -68,9 +67,34 @@ public IOSStartScreenRecordingOptions withVideoQuality(VideoQuality videoQuality
6867
return this;
6968
}
7069

70+
/**
71+
* The Frames Per Second rate of the recorded video. Defaults to 10.
72+
*
73+
* @since Appium 1.10.0
74+
* @param fps frames per second value in range 1..60.
75+
* @return self instance for chaining.
76+
*/
77+
public IOSStartScreenRecordingOptions withFps(int fps) {
78+
this.fps = fps;
79+
return this;
80+
}
81+
82+
/**
83+
* The scaling value to apply. Read https://trac.ffmpeg.org/wiki/Scaling for possible values.
84+
* No scale is applied by default.
85+
*
86+
* @since Appium 1.10.0
87+
* @param videoScale ffmpeg-compatible scale format specifier.
88+
* @return self instance for chaining.
89+
*/
90+
public IOSStartScreenRecordingOptions withVideoScale(String videoScale) {
91+
this.videoScale = checkNotNull(videoScale);
92+
return this;
93+
}
94+
7195
/**
7296
* The maximum recording time. The default value is 180 seconds (3 minutes).
73-
* The maximum value is 10 minutes.
97+
* The maximum value is 30 minutes.
7498
* Setting values greater than this or less than zero will cause an exception. The minimum
7599
* time resolution unit is one second.
76100
*
@@ -88,6 +112,8 @@ public Map<String, Object> build() {
88112
builder.putAll(super.build());
89113
ofNullable(videoType).map(x -> builder.put("videoType", x));
90114
ofNullable(videoQuality).map(x -> builder.put("videoQuality", x));
115+
ofNullable(videoScale).map(x -> builder.put("videoScale", x));
116+
ofNullable(fps).map(x -> builder.put("videoFps", x));
91117
return builder.build();
92118
}
93119
}

0 commit comments

Comments
 (0)