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

Pause and resume screen mirroring using a shortcut #1632

Open
1 task done
AlyMoh opened this issue Jul 29, 2020 · 10 comments · Fixed by #4748
Open
1 task done

Pause and resume screen mirroring using a shortcut #1632

AlyMoh opened this issue Jul 29, 2020 · 10 comments · Fixed by #4748

Comments

@AlyMoh
Copy link

AlyMoh commented Jul 29, 2020

Is your feature request related to a problem? Please describe.
Oftentimes, I find myself wanting to take a temporary screenshot of the tablet display to work with something I've written on my tablet, such as notes or annotations. However, it seems apparent to me that such a feature currently does not exist.

Describe the solution you'd like
It would be great if there was a shortcut that "freezes" the current display of the Android device, i.e. pauses mirroring. When entering the shortcut again, mirroring would be resumed.

Describe alternatives you've considered
As mentioned above, taking temporary screenshots seemed to be the most feasible, yet cumbersome, alternative. Soon enough, there's a bunch of clutter on disk due to the several screenshots that one could take for temporary use only to delete them afterwards, which is, quite frankly, a banal task.

Once could simply record whatever notes one may use, but this would not take into account any content that comes to mind after recording. Furthermore, the issue of removing the recording when done still stands analogously to deleting temporary screenshots.

Additional context
I'm not sure if additional context is warranted, as I believe the above explanation was pretty sufficient. However, further discussion on the matter is more than welcome. If this feature request has already been suggested before (despite my best efforts in looking for a similar one) then a link to it would be greatly appreciated.

@rom1v
Copy link
Collaborator

rom1v commented Aug 1, 2020

Yes, why not. Would you like to work on it?

@AlyMoh
Copy link
Author

AlyMoh commented Aug 1, 2020

Sure. I haven't worked with C in a while (although Java is no big deal for me) and due to increasing work and stress, it may take me a while before I understand the code enough to start working on the feature request.

@rom1v
Copy link
Collaborator

rom1v commented Aug 1, 2020

it may take me a while before I understand the code enough to start working on the feature request.

Basically, the texture must not be updated when pause is enabled:

scrcpy/app/src/screen.c

Lines 443 to 444 in 0870d86

static void
update_texture(struct screen *screen, const AVFrame *frame) {

Instead, if paused is enabled, the last AVFrame must be kept (and av_frame_ref-ed), until pause is disabled (in that case, the texture must be updated with the last AVFrame, which can be discarded).

@Zockerzimmer
Copy link

Even simpler than holding the last frame you could keep a black frame till you continue i guess. Waiting on that feature as well.

@psychowood
Copy link

Just my 2 cents, probably disabling the streaming from the server could be more network/energy efficient

@ttschnz
Copy link

ttschnz commented Mar 9, 2024

Is there any progress on this?

I'd really like this feature. I would, however veto @Zockerzimmer on the black frame: For me the primary use-cases would be using this to "extend" the screen of my tablet, i.e. scroll to a part in a pdf, freeze, scroll to a different part and still have the first part on my laptops screen.

If @AlyMoh won't be doing it any time soon, maybe I could have a look at it?
I should generally be fine with C, and as far as I've seen the changes would be made on the client-side?

rom1v added a commit that referenced this issue Mar 9, 2024
Pause/unpause display on MOD+Shift+p.

It only impacts rendering, the device is still captured, the video
stream transmitted to the device, and recorded if recording is enabled.

Fixes #1632 <#1632>
@rom1v
Copy link
Collaborator

rom1v commented Mar 9, 2024

For me the primary use-cases would be using this to "extend" the screen of my tablet, i.e. scroll to a part in a pdf, freeze, scroll to a different part and still have the first part on my laptops screen.

I like the use case. I implemented a shortcut to pause/unpause the display (MOD+Shift+p, because MOD+p was already used for POWER): #4748

It only impacts rendering, the device is still captured, the video stream transmitted to the device, and recorded (if recording is enabled).

One benefit is that "unpausing" is instantaneous.

maybe I could have a look at it?
I should generally be fine with C, and as far as I've seen the changes would be made on the client-side?

I'm very sorry, I read the message quickly from my phone, I liked the use case and implemented it. I did not read the message until the end, I would have let you implement it 😞

@ttschnz
Copy link

ttschnz commented Mar 9, 2024

That was fast!

I'm very sorry, I read the message quickly from my phone, I liked the use case and implemented it. I did not read the message until the end, I would have let you implement it 😞

No problem, I think you've done a far better job than I would have done. 👍🏽

rom1v added a commit that referenced this issue Mar 9, 2024
Pause/unpause display on MOD+Shift+p.

It only impacts rendering, the device is still captured, the video
stream transmitted to the device and recorded (if recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
@ttschnz
Copy link

ttschnz commented Mar 9, 2024

I've quickly tested it and I am convinced!

Two things that could be discussed:

  • Interaction: During pause, I can still (blindly) control the screen with mouse and keyboard. Is this a feature or a bug?
  • Shortcut: Personally, I'd choose mod+space, but your choice makes sense too.

@rom1v
Copy link
Collaborator

rom1v commented Mar 9, 2024

Thank you for your tests.

Interaction: During pause, I can still (blindly) control the screen with mouse and keyboard. Is this a feature or a bug?

Bug. I disabled the shortcuts interacting with the device during pause, but forgot to disable mouse and keyboard 🤦 (I haven't tested intensively 😉)

Shortcut: Personally, I'd choose mod+space, but your choice makes sense too.

MOD+space may conflict with other OS or Android shortcuts (e.g. to change the keyboard layout).

rom1v added a commit that referenced this issue Mar 9, 2024
Pause/unpause display on MOD+Shift+p.

It only impacts rendering, the device is still captured, the video
stream transmitted to the device and recorded (if recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
rom1v added a commit that referenced this issue Mar 10, 2024
Pause/unpause display on MOD+Shift+p.

It only impacts rendering, the device is still captured, the video
stream transmitted to the device and recorded (if recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
rom1v added a commit that referenced this issue Mar 11, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continue to be transmitted to the device and recorded (if
recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
rom1v added a commit that referenced this issue Mar 11, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continue to be transmitted to the device and recorded (if
recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
rom1v added a commit that referenced this issue Mar 11, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continue to be transmitted to the device and recorded (if
recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
rom1v added a commit that referenced this issue Mar 30, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continues to be transmitted to the device and recorded (if
recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
Giantvince1 pushed a commit to Giantvince1/scrcpy that referenced this issue Jun 7, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continues to be transmitted to the device and recorded (if
recording is enabled).

Fixes Genymobile#1632 <Genymobile#1632>
PR Genymobile#4748 <Genymobile#4748>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants