Skip to content

Instantly share code, notes, and snippets.

Last active March 18, 2020 17:55
What would you like to do?
Record Video Using Appium
// So I found out that its not easy to do this without the right code.
// Funny thing is that it puts a recording on the phone with some random name.mp4
// The hard thing was actually saving it locally.
// When you stop the recording its in a string 64 base you have to decode and then write that byte array to a file.
protected void screenRecordVideo() throws InterruptedException, IOException {
if (platform == OperatingSystem.ANDROID) {
new AndroidStartScreenRecordingOptions()
} else {
// not supported for iOS
String base64String = ((CanRecordScreen)driver).stopRecordingScreen();
byte[] decode = Base64.decodeBase64(base64String);
FileUtils.writeByteArrayToFile(new File("androidclip.mp4"), decode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment