Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
109.86k stars 10.55k forks source link

Using another android device as client #100

Open ghost opened 6 years ago

ghost commented 6 years ago

Thanks for this amazing project. Is it possible to mirror one android screen to another android device using scrcpy-adb connect method? I found adb clients compiled for arm devices and also java implementation of adb client on github. What are your thoughts?

rom1v commented 6 years ago

As is, the client would require SDL and FFmpeg ARM versions, and wrap SDL stuff into an Android application.

But IMO it would be better to write a specific Android client, which would use the Android APIs instead of SDL and FFmpeg.

NickAcPT commented 6 years ago

+1 Would also like to see this turn into a feature.

tailcode commented 6 years ago

Hi @rom1v ! I am working on this. Is it okay to use the name scrcpy for the app?

rom1v commented 6 years ago

@tailcode The name should not be confusing about what application it is, so the very same name is not a good idea.

tailcode commented 6 years ago

@rom1v Thank you. Considering basic functionality of scrcpy, I think my app is ready but not perfect. This is my first app. I want you to take a look at my app and provide me with suggestions. So if you are okay with it please provide me with an email or any other medium to send the apk. And if possible kindly suggest some "wordplay" for the app name.

NickAcPT commented 6 years ago

Hey, sorry for bothering, but is there any plans to make it so there's almost no latency on the android app @tailcode is developing? I know that might need some protocol redesign in order to acomplish such task..

rom1v commented 6 years ago

Considering basic functionality of scrcpy, I think my app is ready but not perfect. This is my first app. I want you to take a look at my app and provide me with suggestions. So if you are okay

Sure. Publish the code somewhere and I'll take a look when I have some time :+1:

tailcode commented 6 years ago

@rom1v Here is the code. Thanks in advance. https://gitlab.com/las2mile/scrcpy-android

rom1v commented 6 years ago

@tailcode Thank you very much. Seems great. :+1: I will definitely check when I have some more time.

For now, just one little remark: you could use adblib as a dependency instead of a copy-paste of their source code:

compile 'com.tananaev:adblib:1.2'
tailcode commented 6 years ago

@rom1v Thank you very much. I agree with you. But I have made small changes to AdbCrypto.java file of adblib. I will see if I can isolate those changes. Meanwhile one issue that I came upon while using the app is, I am unable to open items in gallery and file manager of remote device. When I click on an image or video thumbnail, instead of opening, they are being selected. Please enlighten me if I am missing something.

rom1v commented 6 years ago

@tailcode Hey, I just tested, that works great :+1: Good job!

Is it possible to quit from the client? (I only see the remote fullscreen, so I can't control the client device)

Also, if the devices have a different aspect ratio (typically if I force the navbar to be displayed), the video aspect-ratio is not preserved.

When I click on an image or video thumbnail, instead of opening, they are being selected.

I think there is a similar problem with VLC: if I click quickly while a video is playing, it should display the control bar, but it does not.

tailcode commented 6 years ago

@rom1v Thank you very much for the feedback.

Is it possible to quit from the client?

Yes, when you exit from the app, socket pipe breaks and server terminates. Cleaning of remote device is handled in server code.

I only see the remote fullscreen, so I can't control the client device

You mean input events are not working ? I have tested on few devices and they worked for me. Please let me know what device you are using and I will try to test on it if I can find it in my circle.

One hurdle I have encountered on a Samsung device is, it doesn't have curl or wget binaries in it and the server cannot be downloaded to it by the current implementation. I don't know if all samsung devices are so. I have worked on a new method to push server to remote device which I am testing. I will push them to git once I think it is ready.

rom1v commented 6 years ago

when you exit from the app

How do you do that? The whole client screen displays the remote screen.

You mean input events are not working ?

Yes, input events are workings: they are forwarded to the remote device.

tailcode commented 6 years ago

@rom1v Sorry, I mistook your question.

Is it possible to quit from the client?

Just swipe from bottom edge of screen. You will see android navigation bar.

robsmith11 commented 5 years ago

srccpy-android works really well for me, especially after changing my phone's aspect ratio to match my tablet's with adb shell wm size 1080x1440.

Even with just a wifi connection, the latency is low enough to type without any lag on my bluetooth keyboard, scroll webpages, and watch videos.

Maybe a link could be added in scrcpy's README?

k3dar commented 5 years ago

@tailcode thanks for android client, having problem with landscape device, more info: https://gitlab.com/las2mile/scrcpy-android/issues/3

RomSand commented 5 years ago

It works only wiressly, no USB OTG support ? Thanks.

parkerlreed commented 4 years ago

Any APK for scrcpy-android? Would love to try it out.

robsmith11 commented 4 years ago

@parkerlreed https://gitlab.com/las2mile/scrcpy-android/raw/master/release/scrcpy-release.apk

It works pretty well for me over wifi, but would have lower latency I think if USB connections were supported.

parkerlreed commented 4 years ago

Cheers! Working quite well with Pixel 3 XL host and Fire HD 8 as client

billymcintosh commented 4 years ago

Tried with Xiaomi Mi 9 and Nvidia Shield TV. No dice. It seems to connect but it's just a blank screen.

Scratch that ^

Shield was on ethernet whilst phone was on Wifi. Works when both on wifi.

dudinr1 commented 4 years ago

Is it possible to choose custom resolution or lunch mirror screen from shell (probably for tasker use).

I have broken s8+ which is main device for nexus 7 2013 which is build in in my car dashboard. Both has 1000x1920 resolution and I can choose 1080x1920 inside scrcpy-android-client and my tap to screen doesn't recognize proper.

Besides that, there is no lag, quality is avesome. Good work and thank you a lot for your work

k3dar commented 4 years ago

@dudinr1 you can try add/change resolution before build apk in: app/src/main/res/values/strings.xml

recnac-itna commented 4 years ago

@tailcode First, thanks a lot for your android client project. It's very useful in my scenario.

By using your project, I have a problem in control. The controls such as tap and drag work like a charm in this PC client. But for your android client, the operations are easy to be lost or misunderstood.

Do you have time to track this issue? Thanks a lot.

kingvhit commented 4 years ago

Can I fork this repository to maintain this one, I am very interest on it.

slayerkodi commented 4 years ago

Is there still development on this?

hoasis2 commented 4 years ago

Is there still development on this?

Here is not the proper place for this. Better check out here: gitlab.com/las2mile/scrcpy-android

updeshxp commented 4 years ago

Working, tested on Galaxy S8 :)

tailcode commented 4 years ago

Dear All Sorry for the delayed response. I am aware this is not proper place for this but scrcpy-android started here. I am glad that my tiny project is being usable to someone. I am not sure if I will continue on the project. Interested people can fork and work on it. I believe the code is simple and straight forward. I am not sure which license applies for it. Also there seems adb wireless implementation changes coming in Android 11 Dev previews. I will keep an eye on it. Again I would like to thank @rom1v for scrcpy project.

billymcintosh commented 4 years ago

Very respectable response and code can almost always be better. Java is my coffee but I'll have a deep dive and use my external thought process to help if possible.

Neffez commented 4 years ago

Dear All Sorry for the delayed response. I am aware this is not proper place for this but scrcpy-android started here. I am glad that my tiny project is being usable to someone. I am not sure if I will continue on the project. Interested people can fork and work on it. I believe the code is simple and straight forward. I am not sure which license applies for it. Also there seems adb wireless implementation changes coming in Android 11 Dev previews. I will keep an eye on it. Again I would like to thank @rom1v for scrcpy project.

Thanks for your work, I'm very interested in it. Maybe you could decide on a license, otherwise it's kind of problematic to use and work on your code. You could just copy a license template from https://opensource.org/licenses (for exmaple GPL or MIT).

parkerlreed commented 4 years ago

An Android build with the new multi-touch support would be fantastic.

sevenleo commented 3 years ago

@rom1v Here is the code. Thanks in advance. https://gitlab.com/las2mile/scrcpy-android

Don't working on my devices, when i hit start the app hangs and don't connect. I tried on android 7, 8 and 10

nwazuo commented 3 years ago

@rom1v Here is the code. Thanks in advance. https://gitlab.com/las2mile/scrcpy-android

Don't working on my devices, when i hit start the app hangs and don't connect. I tried on android 7, 8 and 10

Same thing here too

fragtion commented 3 years ago

Works for me when connecting to some devices but not others. I hope someone finds the problem and we can update this as I find this app incredibly useful

DienoX commented 3 years ago

@rom1v Can we count on an official version of the scrcpy client for android? This version would complete this amazing project in its entirety.

tailcode commented 3 years ago

Dear All I have pushed an update to scrcpy-android. Most of the issues I believe are worked out. Mirrors devices upto android 10. Android 11 wireless debugging needs to be worked out.

k3dar commented 3 years ago

I have pushed an update to scrcpy-android. Most of the issues I believe are worked out. Mirrors devices upto android 10. Android 11 wireless debugging needs to be worked out.

thx! finaly forking with phone as remote to car-7"-landscape-radio :) coordinate ok, only i add 1024x600 resolution do strings.xml

but is little problem with tap, sometime is tap registered as "tap and hold" and is need close/reopen app, also when phone is sleeped, app keep black and is need to reopen.... anyway thx again :)

nwazuo commented 3 years ago

Dear All I have pushed an update to scrcpy-android. Most of the issues I believe are worked out. Mirrors devices upto android 10. Android 11 wireless debugging needs to be worked out.

It now works flawlessly for me. Thank you so much for this @tailcode. You're a real champ!

I use two phones currently(one given to me by a friend for temporary use). The one which I own has a bad screen and I sometimes use scrcpy on my PC to operate it. Now I can do so from my second phone. This means I don't have to carry my PC around just to use my other phone.

Just to let you know how much this project has helped me !

@tailcode I'd really love to get in touch with you and I'm not sure how. Please shoot me a mail when you see this at: chizonwazuo@yahoo.com

xromansx commented 3 years ago

Latest version is 2.0 ?

soopacrucial commented 2 years ago

Excellent job thanks Anwar Mohammad, scrcpy-android now works for me too,! Any chance you might implement the following scpcpy switch please?:

-S, --turn-screen-off Turn the device screen off immediately

It would allow me to save battery power on the device being controlled.

serifpersia commented 2 years ago

@tailcode Any updates for android 11? Seems like the port changes every time and the app listens the ip address connection using 5555 port and in android 11 that is not the case. Anyone knows how to fix this? I know I can add stuff in build.prop to make the port always 5555 but my phone has no screen so I can't root it with magisk.... How hard is it to add a field to specifiy the port I've seen old apps that send sensor data to control driving games and they had ip and port fileds. EDIT: Seems like doing adb tpcip 5555 works(have to do it again if wifi is turned off and on)

eGit commented 2 years ago

Amazing project! I will try it out.

A few people asked but it was never answered: why doesn't it support connection via USB? Or does it (I only read about wireless so far)? Maybe USB is not faster?

Off Topic: scrcpy allows you to control your Android device from Win/OSX/Linux. scrcpy-android allows you to control your Android device from a second Android device.

Wouldn't it make sense to allow controlling a Win/OSX/Linux PC from an Android device? This is still missing and I have tons of use cases. VNC & Co. has just worse performance compared to scrcpy.

Btw, does somebody have a few links detailing how scrcpy works internally? What protocols are used to do the connection and data transfer both via USB and Wifi? What tricks are used to make it faster then VNC?

Thanks!

rom1v commented 2 years ago

Btw, does somebody have a few links detailing how scrcpy works internally? What protocols are used to do the connection and data transfer both via USB and Wifi?

brunoais commented 2 years ago

Wouldn't it make sense to allow controlling a Win/OSX/Linux PC from an Android device? This is still missing and I have tons of use cases. VNC & Co. has just worse performance compared to scrcpy.

Not for scrcpy, IMO Also, you can already do that with some programs such as TeamViewer or Anydesk

eGit commented 2 years ago

Wouldn't it make sense to allow controlling a Win/OSX/Linux PC from an Android device? This is still missing and I have tons of use cases. VNC & Co. has just worse performance compared to scrcpy.

Not for scrcpy, IMO Also, you can already do that with some programs such as TeamViewer or Anydesk

Can you quickly explain why it wouldn't make sense? Technically?

Proprietary alternatives exist in every niche of software...doesn't mean we should want open source alternatives.

brunoais commented 2 years ago

Controlling windows remotely is a huge "can of worms". Lots of COM to connect to and hoops to jump through. A Linux stack is not as complex but would require supporting multiple means to achieve it (don't quote me on this because this is 2nd hand information) A MacOS cannot be controlled by software that isn't signed and, in some way, "approved" by Apple (same kind of signing windows already enforces for some things).

On Android, the means are straightforward-enough and there's almost one way that works in nearly all phones.

It's a difference between bloated software filled with bugs and no time to fix them and small software which solves 1 "small" problem in its essence.

If you still think it's easy to make the opposite while it hasn't been solved yet in open-source such as placing a VNC server on the OS and having a VNC client on your android phone, then feel free to bring a counter-argument.

rom1v commented 2 years ago

Can you quickly explain why it wouldn't make sense? Technically?

Technically, mirroring the computer on the Android device would be a totally different program, with almost nothing in common with scrcpy. So it could be a separate software.

eGit commented 2 years ago

Controlling windows remotely is a huge "can of worms". Lots of COM to connect to and hoops to jump through. A Linux stack is not as complex but would require supporting multiple means to achieve it (don't quote me on this because this is 2nd hand information) A MacOS cannot be controlled by software that isn't signed and, in some way, "approved" by Apple (same kind of signing windows already enforces for some things).

On Android, the means are straightforward-enough and there's almost one way that works in nearly all phones.

It's a difference between bloated software filled with bugs and no time to fix them and small software which solves 1 "small" problem in its essence.

If you still think it's easy to make the opposite while it hasn't been solved yet in open-source such as placing a VNC server on the OS and having a VNC client on your android phone, then feel free to bring a counter-argument.

Thanks for the explanation - I really was just curious as I have no clue. What is the best existing solution (performance both via Wifi and direct USB tethering) using Linux on an Android client? What is the best open source solution?

brunoais commented 2 years ago

@eGit Which display server you use? If you don't know, which distro?