mirror of https://github.com/Genymobile/scrcpy
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
955 B
Java
31 lines
955 B
Java
package com.genymobile.scrcpy;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class ScrCpyServer {
|
|
|
|
public static void scrcpy() throws IOException {
|
|
String deviceName = DeviceUtil.getDeviceName();
|
|
ScreenInfo initialScreenInfo = DeviceUtil.getScreenInfo();
|
|
int width = initialScreenInfo.getLogicalWidth();
|
|
int height = initialScreenInfo.getLogicalHeight();
|
|
try (DesktopConnection connection = DesktopConnection.open(deviceName, width, height)) {
|
|
try {
|
|
new ScreenStreamer(connection).streamScreen();
|
|
} catch (IOException e) {
|
|
System.err.println("Screen streaming interrupted: " + e.getMessage());
|
|
System.err.flush();
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void main(String... args) throws Exception {
|
|
try {
|
|
scrcpy();
|
|
} catch (Throwable t) {
|
|
t.printStackTrace();
|
|
throw t;
|
|
}
|
|
}
|
|
}
|