-
-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #814 from mykola-mokhnach/record_screen
Add endpoints for screen recording API for iOS and Android
- Loading branch information
Showing
14 changed files
with
687 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
src/main/java/io/appium/java_client/android/AndroidStartScreenRecordingOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.java_client.android; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import io.appium.java_client.screenrecording.BaseStartScreenRecordingOptions; | ||
|
||
import java.time.Duration; | ||
import java.util.Map; | ||
|
||
import static java.util.Optional.ofNullable; | ||
|
||
public class AndroidStartScreenRecordingOptions | ||
extends BaseStartScreenRecordingOptions<AndroidStartScreenRecordingOptions> { | ||
private Integer bitRate; | ||
private String videoSize; | ||
|
||
public static AndroidStartScreenRecordingOptions startScreenRecordingOptions() { | ||
return new AndroidStartScreenRecordingOptions(); | ||
} | ||
|
||
/** | ||
* The video bit rate for the video, in megabits per second. | ||
* The default value is 4. You can increase the bit rate to improve video quality, | ||
* but doing so results in larger movie files. | ||
* The value of 5000000 equals to 5Mb/sec. | ||
* | ||
* @param bitRate The actual bit rate (Mb/s). | ||
* @return self instance for chaining. | ||
*/ | ||
public AndroidStartScreenRecordingOptions withBitRate(int bitRate) { | ||
this.bitRate = bitRate; | ||
return this; | ||
} | ||
|
||
/** | ||
* The video size of the generated media file. The format is WIDTHxHEIGHT. | ||
* The default value is the device's native display resolution (if supported), | ||
* 1280x720 if not. For best results, | ||
* use a size supported by your device's Advanced Video Coding (AVC) encoder. | ||
* | ||
* @param videoSize The actual video size: WIDTHxHEIGHT. | ||
* @return self instance for chaining. | ||
*/ | ||
public AndroidStartScreenRecordingOptions withVideoSize(String videoSize) { | ||
this.videoSize = videoSize; | ||
return this; | ||
} | ||
|
||
/** | ||
* The maximum recording time. The default and maximum value is 180 seconds (3 minutes). | ||
* Setting values greater than this or less than zero will cause an exception. The minimum | ||
* time resolution unit is one second. | ||
* | ||
* @param timeLimit The actual time limit of the recorded video. | ||
* @return self instance for chaining. | ||
*/ | ||
@Override | ||
public AndroidStartScreenRecordingOptions withTimeLimit(Duration timeLimit) { | ||
return super.withTimeLimit(timeLimit); | ||
} | ||
|
||
@Override | ||
public Map<String, Object> build() { | ||
final ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder(); | ||
builder.putAll(super.build()); | ||
ofNullable(bitRate).map(x -> builder.put("bitRate", x)); | ||
ofNullable(videoSize).map(x -> builder.put("videoSize", x)); | ||
return builder.build(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/io/appium/java_client/android/AndroidStopScreenRecordingOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.java_client.android; | ||
|
||
import io.appium.java_client.screenrecording.BaseStopScreenRecordingOptions; | ||
|
||
public class AndroidStopScreenRecordingOptions extends | ||
BaseStopScreenRecordingOptions<AndroidStopScreenRecordingOptions> { | ||
|
||
public static AndroidStopScreenRecordingOptions stopScreenRecordingOptions() { | ||
return new AndroidStopScreenRecordingOptions(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.