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

v3.1 requires additional client adaptation, not just server version update #5733

Open
cprogpb opened this issue Jan 4, 2025 · 4 comments
Open

Comments

@cprogpb
Copy link

cprogpb commented Jan 4, 2025

Issue: v3.1 requires additional client adaptation, not just server version update

Description

I'm developing a Python client. In previous version updates (from v2.7 to v3.0.2), I only needed to update the server version and version number to maintain functionality. However, in v3.1, due to the change in Inject main display events to the original display, just updating the server is no longer sufficient.

Current Situation

  • Previous version updates: only needed to replace server and update version number
  • v3.1 version: requires client code modifications to adapt to new coordinate calculation logic
    • Main display (displayId = 0) now uses deviceSize instead of inputSize
    • Affects all input event handling (touch, keyboard, mouse)

Questions

  1. Is this an expected breaking change?
  2. Is there a recommended client adaptation approach?
  3. Could you provide some documentation or examples about the new coordinate mapping system?

Looking forward to some guidance on how to properly adapt to this change.

@rom1v
Copy link
Collaborator

rom1v commented Jan 4, 2025

v3.1 version: requires client code modifications to adapt to new coordinate calculation logic

It should not. The client always sends coordinates relative to the video size, and the mapping is done by the server.

What has changed is that injecting control events properly requires a display for coordinates mapping. See #5611.

@cprogpb
Copy link
Author

cprogpb commented Jan 5, 2025

v3.1 版本:需要修改客户端代码以适应新的坐标计算逻辑

它不应该。客户端始终发送相对于视频大小的坐标,映射由服务器完成。

更改的是,正确注入控制事件需要坐标映射的显示。请参阅 #5611

Thanks for your response. I want to make sure I understand correctly:

  1. For coordinate handling:

    • We don't need to change how we calculate coordinates in the client
    • We should keep sending coordinates relative to video size
    • Server handles the mapping
  2. For the display requirement:

    • Could you clarify what exactly needs to be updated in the client for "display for coordinates mapping"?
    • Do we need to add/modify any specific parameters when starting the scrcpy server?
    • Is there any documentation about the required display parameters?

I'm looking at #5611 but would appreciate if you could point out the specific changes needed for client implementation.

@rom1v
Copy link
Collaborator

rom1v commented Jan 5, 2025

  1. For coordinate handling:
    • We don't need to change how we calculate coordinates in the client
    • We should keep sending coordinates relative to video size
    • Server handles the mapping

✔️

Could you clarify what exactly needs to be updated in the client for "display for coordinates mapping"?

Nothing. Just now you cannot use scrcpy-server only to send events without capturing a video stream (i.e. with --no-video/video=false), because the events mapping depends on the mirrored display.

In other words, if your client does the same as scrcpy (receive a video stream, listen to events in the local window and inject them), there is nothing to change in the client.

@cprogpb
Copy link
Author

cprogpb commented Jan 5, 2025

无。现在你不能只使用 scrcpy-server 来发送事件而不捕获视频流(即使用 --no-video/video=false),因为事件映射取决于镜像显示。

换句话说,如果您的客户端执行与 scrcpy 相同的操作(接收视频流、侦听本地窗口中的事件并注入它们),则客户端中没有什么可更改的。

Thank you for your help! Now I understand the issue.

In my implementation, I was running three separate scrcpy server instances:

  1. One for video streaming
  2. One for audio streaming
  3. One for control with video disabled

The issue was that I disabled video stream in the control server instance (video=false). Now I understand that in v3.1, the control events require a video stream for coordinate mapping, so I need to keep video enabled when using control features.

I'll modify my implementation to ensure the control server has video stream enabled. Thanks for pointing this out!

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