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

[ws-qvh] Scale calculation issue #48

Closed
egegrsn opened this issue Nov 17, 2020 · 6 comments
Closed

[ws-qvh] Scale calculation issue #48

egegrsn opened this issue Nov 17, 2020 · 6 comments

Comments

@egegrsn
Copy link

egegrsn commented Nov 17, 2020

While using ws-qvh, there is a scale calculation issue, which causes clicking coordinate mistakes.

@drauggres
Copy link
Collaborator

Hello again :-).

Here is what I need from you:

  1. open devtools for a "stream page"
  2. run var {videoWidth, videoHeight} = document.getElementsByTagName('video')[0]; console.log({videoWidth, videoHeight}) in devtools console
  3. open "network" tab in devtools
  4. click in the top-left, then bottom-right corners of the video

Paste here:

  1. output from the second step
  2. response for GET wda/screen request
  3. request payloads for two POST wda/touch/perform

For iPhone 11 Pro I got:

  1. {videoWidth: 1126, videoHeight: 2436}
{
  "value" : {
    "statusBarSize" : {
      "width" : 375,
      "height" : 44
    },
    "scale" : 3
  },
  "sessionId" : "DFA28E6E-0B23-4AF1-B352-9B6ED8CBB7E0"
}
{"actions":[{"action":"tap","options":{"x":2,"y":2}}]}
{"actions":[{"action":"tap","options":{"x":373,"y":811}}]}
Screenshot. wda/screen

wda-screen

Screenshot. wda/touch/perform

wda-touch

@drauggres drauggres changed the title Scale calculation issue [ws-qvh] Scale calculation issue Nov 17, 2020
@egegrsn
Copy link
Author

egegrsn commented Nov 18, 2020

For iPhone 7 Plus I got:

  1. {videoWidth: 1080, videoHeight: 1920}
{
  "value" : {
    "statusBarSize" : {
      "width" : 414,
      "height" : 20
    },
    "scale" : 3
  },
  "sessionId" : "CAAB2212-6AEF-4709-922F-8DBAEF92CAFE"
}
  1. {actions: [{action: "tap", options: {x: 3, y: 3}}]}
    {actions: [{action: "tap", options: {x: 356, y: 636}}]}

@egegrsn
Copy link
Author

egegrsn commented Nov 23, 2020

Hi, have you found anything about this issue?

@drauggres
Copy link
Collaborator

Did you try with develop branch? Looks like this problem has already been fixed there.

In master: width = videoWidth / scale; height = videoHeight / scale; // (360 x 640)
In develop: width = statusBarSize.width; height = videoHeight / (videoWidth / statusBarSize.width); // (414 x 736)

https://developer.apple.com/library/archive/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/Displays/Displays.html

@egegrsn
Copy link
Author

egegrsn commented Nov 24, 2020

Hi, I have tried develop branch. Bottom side of the UI does not work properly. I can't click anything from dock.

I tried to clone develop branch like
git clone -b develop https://github.com/NetrisTV/ws-scrcpy.git

@drauggres
Copy link
Collaborator

I tried to clone develop branch like
git clone -b develop https://github.com/NetrisTV/ws-scrcpy.git

OK, this will work too (you could checkout to develop without cloning everything again).

Unfortunately I can't debug it without a real device. You'll have to deal with it yourself.
For a start you can check coordinates (as you did before) and verify, that they are in the correct range ([0; 414], [0; 736]).
Then try to install Appium Desktop and see what coordinates it generates for clicks on the dock.

P.S. you rebuilt frontend after switching to develop, right? (npm install;npm run dist:qvhack:frontend)

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

No branches or pull requests

2 participants