Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for native screen recording #330

Merged
merged 5 commits into from
Feb 7, 2025

Conversation

mykola-mokhnach
Copy link
Contributor

No description provided.

@mykola-mokhnach mykola-mokhnach changed the title eat: Add support for native screen recording feat: Add support for native screen recording Feb 6, 2025
README.md Outdated
--- | --- | --- | --- | ---
fps | number | no | Frame Per Second setting for the resulting screen recording. 24 by default. Higher FPS values may significantly increase the size of the resulting video. | 60
codec | number | no | Possible codec value, where `0` means H264 (the default setting), `1` means HEVC | 1
displayID | number | no | Valid display identifier to record the video from. Main display ID is assumed by default. Use the `system_profiler -json SPDisplaysDataType` Terminal command to list IDs of connected displays. | 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't test this PR out yet but I saw this displayID could be a string such as b:

$ system_profiler -json SPDisplaysDataType
{
  "SPDisplaysDataType" : [
    {
      "_name" : "Apple M3",
      "_spdisplays_airplay" : "spdisplays_yes",
      "spdisplays_mtlgpufamilysupport" : "spdisplays_metal3",
      "spdisplays_ndrvs" : [
        {
          "_name" : "Color LCD",
          "_spdisplays_display-product-id" : "a04f",
          "_spdisplays_display-serial-number" : "fd626d62",
          "_spdisplays_display-vendor-id" : "610",
          "_spdisplays_display-week" : "0",
          "_spdisplays_display-year" : "0",
          "_spdisplays_displayID" : "1",
          "_spdisplays_pixels" : "3600 x 2338",
          "_spdisplays_resolution" : "1800 x 1169 @ 120.00Hz",
          "spdisplays_ambient_brightness" : "spdisplays_yes",
          "spdisplays_connection_type" : "spdisplays_internal",
          "spdisplays_display_type" : "spdisplays_built-in-liquid-retina-xdr",
          "spdisplays_main" : "spdisplays_yes",
          "spdisplays_mirror" : "spdisplays_off",
          "spdisplays_online" : "spdisplays_yes",
          "spdisplays_pixelresolution" : "spdisplays_3024x1964Retina"
        },
        {
          "_name" : "Sidecar Display",
          "_spdisplays_CGSDID" : "11",
          "_spdisplays_display-product-id" : "69506164",
          "_spdisplays_display-serial-number" : "8713861c",
          "_spdisplays_display-vendor-id" : "6161706c",
          "_spdisplays_display-week" : "0",
          "_spdisplays_display-year" : "0",
          "_spdisplays_displayID" : "b",
          "_spdisplays_pixels" : "2204 x 1484",
          "_spdisplays_resolution" : "1102 x 742 @ 60.00Hz",
          "spdisplays_connection_type" : "spdisplays_airplay",
          "spdisplays_depth" : "CGSThirtytwoBitColor",
          "spdisplays_mirror" : "spdisplays_off",
          "spdisplays_pixelresolution" : "2204 x 1484",
          "spdisplays_resolution" : "1102 x 742 @ 60.00Hz",
          "spdisplays_virtualdevice" : "spdisplays_yes"
        }
      ],
      "spdisplays_vendor" : "sppci_vendor_Apple",
      "sppci_bus" : "spdisplays_builtin",
      "sppci_cores" : "10",
      "sppci_device_type" : "spdisplays_gpu",
      "sppci_model" : "Apple M3"
    }
  ]
}%

Copy link
Member

@KazuCocoa KazuCocoa Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, the secondary one is 11:

(lldb) po XCUIScreen.screens
<__NSArrayM 0x6000024f8330>(
XCUIScreen (displayID: 1, main: YES),
XCUIScreen (displayID: 11, main: NO)
)

So, I think it would be nice to add an endpoint to return available screen info with displayID => oh, the error message returns available ones (verifyDisplayWithID)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's in hex notation: b hex == 11 decimal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, noticed that:

python3 -c "print(int('b', 16))"
11

Maybe we could guide here to try out macos:screenshots also to check display IDs and corresponding screenshots to help detect the target display id especially with external dispkays?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a separate execute method to list available displays info as well

Copy link
Member

@KazuCocoa KazuCocoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg, the implementation was similar to iOS's WDA

@mykola-mokhnach mykola-mokhnach merged commit d2f5b25 into appium:master Feb 7, 2025
11 checks passed
@mykola-mokhnach mykola-mokhnach deleted the video_rec branch February 7, 2025 08:17
github-actions bot pushed a commit that referenced this pull request Feb 7, 2025
## [2.1.0](v2.0.0...v2.1.0) (2025-02-07)

### Features

* Add support for native screen recording ([#330](#330)) ([d2f5b25](d2f5b25))
Copy link

github-actions bot commented Feb 7, 2025

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants