Skip to content

Commit 9deda0e

Browse files
authored
Add pixel format (#200)
* add pixel_format * update changelog
1 parent 9585b16 commit 9deda0e

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Read `release_notes.md` for commit level details.
55
## [Unreleased]
66

77
### Enhancements
8+
- Add `pixelFormat` argument in screen record for iOS
89

910
### Bug fixes
1011

lib/appium_lib_core/ios/xcuitest/device.rb

+2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ module Device
8080
# is too slow or too fast. Defaults to 10. This can decrease the resulting file size.
8181
# @param [String] video_scale The scaling value to apply. Read https://trac.ffmpeg.org/wiki/Scaling for possible values.
8282
# No scale is applied by default.
83+
# @param [String] pixel_format Output pixel format. Run `ffmpeg -pix_fmts` to list possible values.
84+
# For Quicktime compatibility, set to "yuv420p" along with videoType: "libx264".
8385
#
8486
# @example
8587
#

lib/appium_lib_core/ios/xcuitest/device/screen.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def self.add_methods
2323
# rubocop:disable Metrics/ParameterLists
2424
def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil,
2525
video_type: 'mjpeg', time_limit: '180', video_quality: 'medium',
26-
video_fps: nil, video_scale: nil)
26+
video_fps: nil, video_scale: nil, pixel_format: nil)
2727
option = ::Appium::Core::Base::Device::ScreenRecord.new(
2828
remote_path: remote_path, user: user, pass: pass, method: method, force_restart: force_restart
2929
).upload_option
@@ -34,6 +34,7 @@ def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT'
3434

3535
option[:videoFps] = video_fps unless video_fps.nil?
3636
option[:videoScale] = video_scale unless video_scale.nil?
37+
option[:pixelFormat] = pixel_format unless pixel_format.nil?
3738

3839
execute(:start_recording_screen, {}, { options: option })
3940
end

test/unit/ios/device/w3c/commands_test.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ def test_start_recording_screen_custom
6363

6464
stub_request(:post, "#{SESSION}/appium/start_recording_screen")
6565
.with(body: { options: {
66-
videoType: 'libx264', timeLimit: '60', videoQuality: 'medium', videoFps: '50', videoScale: '320:240'
66+
videoType: 'libx264', timeLimit: '60', videoQuality: 'medium',
67+
videoFps: '50', videoScale: '320:240', pixelFormat: 'yuv420p'
6768
} }.to_json)
6869
.to_return(headers: HEADER, status: 200, body: { value: ['a'] }.to_json)
6970

70-
@driver.start_recording_screen video_type: 'libx264', time_limit: '60', video_fps: '50', video_scale: '320:240'
71+
@driver.start_recording_screen(video_type: 'libx264', time_limit: '60',
72+
video_fps: '50', video_scale: '320:240', pixel_format: 'yuv420p')
7173

7274
assert_requested(:post, "#{SESSION}/appium/start_recording_screen", times: 1)
7375
end

0 commit comments

Comments
 (0)