How to use WindowsStartScreenRecordingOptions class of io.appium.java_client.windows package

Best io.appium code snippet using io.appium.java_client.windows.WindowsStartScreenRecordingOptions

Run io.appium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

WindowsStartScreenRecordingOptions.java

Source: WindowsStartScreenRecordingOptions.java Github

copy
1/*
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * See the NOTICE file distributed with this work for additional
5 * information regarding copyright ownership.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package io.appium.java_client.windows;
18
19import com.google.common.collect.ImmutableMap;
20import io.appium.java_client.screenrecording.BaseStartScreenRecordingOptions;
21
22import java.time.Duration;
23import java.util.Map;
24
25import static java.util.Optional.ofNullable;
26
27public class WindowsStartScreenRecordingOptions
28        extends BaseStartScreenRecordingOptions<WindowsStartScreenRecordingOptions> {
29    private Integer fps;
30    private String videoFilter;
31    private String preset;
32    private Boolean captureCursor;
33    private Boolean captureClicks;
34    private String audioInput;
35
36    public static WindowsStartScreenRecordingOptions startScreenRecordingOptions() {
37        return new WindowsStartScreenRecordingOptions();
38    }
39
40    /**
41     * The count of frames per second in the resulting video.
42     * Increasing fps value also increases the size of the resulting
43     * video file and the CPU usage.
44     *
45     * @param fps The actual frames per second value.
46     *            The default value is 15.
47     * @return self instance for chaining.
48     */
49    public WindowsStartScreenRecordingOptions withFps(int fps) {
50        this.fps = fps;
51        return this;
52    }
53
54    /**
55     * Whether to capture the mouse cursor while recording
56     * the screen. Disabled by default.
57     *
58     * @return self instance for chaining.
59     */
60    public WindowsStartScreenRecordingOptions enableCursorCapture() {
61        this.captureCursor = true;
62        return this;
63    }
64
65    /**
66     * Whether to capture the click gestures while recording
67     * the screen. Disabled by default.
68     *
69     * @return self instance for chaining.
70     */
71    public WindowsStartScreenRecordingOptions enableClicksCapture() {
72        this.captureClicks = true;
73        return this;
74    }
75
76    /**
77     * If provided then the given audio input will be used to record the computer audio
78     * along with the desktop video. The list of available devices could be retrieved using
79     * `ffmpeg -list_devices true -f dshow -i dummy` command.
80     *
81     * @param audioInput One of valid audio input names listed by ffmpeg
82     * @return self instance for chaining.
83     */
84    public WindowsStartScreenRecordingOptions withAudioInput(String audioInput) {
85        this.audioInput = audioInput;
86        return this;
87    }
88    
89    /**
90     * The video filter spec to apply for ffmpeg.
91     * See https://trac.ffmpeg.org/wiki/FilteringGuide for more details on the possible values.
92     * Example: Set it to `scale=ifnot(gte(iw\,1024)\,iw\,1024):-2` in order to limit the video width
93     * to 1024px. The height will be adjusted automatically to match the actual screen aspect ratio.
94     *
95     * @param videoFilter Valid ffmpeg video filter spec string.
96     * @return self instance for chaining.
97     */
98    public WindowsStartScreenRecordingOptions withVideoFilter(String videoFilter) {
99        this.videoFilter = videoFilter;
100        return this;
101    }
102
103    /**
104     * A preset is a collection of options that will provide a certain encoding speed to compression ratio.
105     * A slower preset will provide better compression (compression is quality per filesize).
106     * This means that, for example, if you target a certain file size or constant bit rate, you will
107     * achieve better quality with a slower preset. Read https://trac.ffmpeg.org/wiki/Encode/H.264
108     * for more details.
109     *
110     * @param preset One of the supported encoding presets. Possible values are:
111     *     - ultrafast
112     *     - superfast
113     *     - veryfast (default)
114     *     - faster
115     *     - fast
116     *     - medium
117     *     - slow
118     *     - slower
119     *     - veryslow
120     * @return self instance for chaining.
121     */
122    public WindowsStartScreenRecordingOptions withPreset(String preset) {
123        this.preset = preset;
124        return this;
125    }
126
127    /**
128     * The maximum recording time. The default value is 600 seconds (10 minutes).
129     * The minimum time resolution unit is one second.
130     *
131     * @param timeLimit The actual time limit of the recorded video.
132     * @return self instance for chaining.
133     */
134    @Override
135    public WindowsStartScreenRecordingOptions withTimeLimit(Duration timeLimit) {
136        return super.withTimeLimit(timeLimit);
137    }
138
139    @Override
140    public Map<String, Object> build() {
141        final ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
142        builder.putAll(super.build());
143        ofNullable(fps).map(x -> builder.put("fps", x));
144        ofNullable(preset).map(x -> builder.put("preset", x));
145        ofNullable(videoFilter).map(x -> builder.put("videoFilter", x));
146        ofNullable(captureClicks).map(x -> builder.put("captureClicks", x));
147        ofNullable(captureCursor).map(x -> builder.put("captureCursor", x));
148        ofNullable(audioInput).map(x -> builder.put("audioInput", x));
149        return builder.build();
150    }
151}
152
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)