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

Add new screen recording options for iOS #1067

Merged
merged 3 commits into from
Nov 22, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,24 @@ public class IOSStartScreenRecordingOptions
extends BaseStartScreenRecordingOptions<IOSStartScreenRecordingOptions> {
private String videoType;
private String videoQuality;
private String videoScale;
private Integer fps;

public static IOSStartScreenRecordingOptions startScreenRecordingOptions() {
return new IOSStartScreenRecordingOptions();
}

public enum VideoType {
H264, MP4, FMP4
}

/**
* The format of the screen capture to be recorded.
* Available formats: "h264", "mp4" or "fmp4". Default is "mp4".
* Only works for Simulator.
* The video codec type used for encoding of the recorded screen capture.
* Execute `ffmpeg -codecs` in the terminal to see the list of supported video codecs.
* 'mjpeg' by default.
*
* @param videoType one of available format names.
* @since Appium 1.10.0
* @param videoType one of available video codec names, for example 'libx264'.
* @return self instance for chaining.
*/
public IOSStartScreenRecordingOptions withVideoType(VideoType videoType) {
this.videoType = checkNotNull(videoType).name().toLowerCase();
public IOSStartScreenRecordingOptions withVideoType(String videoType) {
this.videoType = checkNotNull(videoType);
return this;
}

Expand All @@ -68,9 +67,35 @@ public IOSStartScreenRecordingOptions withVideoQuality(VideoQuality videoQuality
return this;
}

/**
* The Frames Per Second rate of the recorded video. Defaults to 10.
*
* @since Appium 1.10.0
* @param fps frames per second value in range 1..60.
* @return self instance for chaining.
*/
public IOSStartScreenRecordingOptions withFps(int fps) {
this.fps = fps;
return this;
}


/**
* The scaling value to apply. Read https://trac.ffmpeg.org/wiki/Scaling for possible values.
* No scale is applied by default.
*
* @since Appium 1.10.0
* @param videoScale ffmpeg-compatible scale format specifier.
* @return self instance for chaining.
*/
public IOSStartScreenRecordingOptions withVideoScale(String videoScale) {
this.videoScale = checkNotNull(videoScale);
return this;
}

/**
* The maximum recording time. The default value is 180 seconds (3 minutes).
* The maximum value is 10 minutes.
* The maximum value is 30 minutes.
* Setting values greater than this or less than zero will cause an exception. The minimum
* time resolution unit is one second.
*
Expand All @@ -88,6 +113,8 @@ public Map<String, Object> build() {
builder.putAll(super.build());
ofNullable(videoType).map(x -> builder.put("videoType", x));
ofNullable(videoQuality).map(x -> builder.put("videoQuality", x));
ofNullable(videoScale).map(x -> builder.put("videoScale", x));
ofNullable(fps).map(x -> builder.put("videoFps", x));
return builder.build();
}
}