Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby wrapper for ios/android screen capture using simctl/adb screenshot/screenrecord.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
>= 0
~> 10.0
 Project Readme

Mobile::Emulator::Screencapture

Gem Version Build Status

Ruby wrapper for take screenshot and screenrecord on ios/android emulators.

How to work

Android

Using adb screencap and adb screenrecord
see: https://developer.android.com/studio/command-line/adb.html

adb screenrcord is only supported: Android >= 4.4(API Level 19)

iOS

Not supported yet

Using xcrun simctl io screenshot and xcrun simctl io recordVideo

see: xcrun simctl io --help

xcrun simctl io screenshot is only supported: Xcode >= 8.2

Installation

gem 'mobile-emulator-screencapture'

Usage

Android

require 'mobile/emulator/screencapture'

android = Mobile::Emulator::Screencapture.create(
  platform: "android",
  screenshot_dir: "./screenshot",
  screenrecord_dir: "./screenrecord",

  # options for adb screenrecord
  width: 720,
  height: 360
  bit_rate: 6_000_000,
  time_limit: 180
)

android.screenshot("test")
# > ./screenshot/test.png

android.start_screenrecord("test")
sleep 30
android.stop_screenrecord
# > ./screenrecord/test.mp4

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Kesin11/mobile-emulator-screencapture.

License

The gem is available as open source under the terms of the MIT License.