Skip to content

Commit 8e2ff1a

Browse files
authored
Merge pull request #63 from codeskyblue/feat/scrcpy-server-unified-ws
remote/scrcpy.py: add docstrings and improve websocket/video handling
2 parents 0c384b2 + 40f28eb commit 8e2ff1a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

uiautodev/remote/scrcpy.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,18 @@ def _start_scrcpy_server(self, control: bool = True) -> AdbConnection:
104104
logger.info('scrcpy server JAR pushed to device')
105105

106106
# 构建启动 scrcpy 服务器的命令
107-
start_command = (
108-
'CLASSPATH=/data/local/tmp/scrcpy_server.jar '
109-
'app_process / '
110-
f'com.genymobile.scrcpy.Server {self.version} '
111-
'log_level=info max_size=1024 max_fps=30 '
112-
'video_bit_rate=8000000 tunnel_forward=true '
113-
'send_frame_meta=true '
114-
f'control={"true" if control else "false"} '
115-
'audio=false show_touches=false stay_awake=false '
116-
'power_off_on_close=false clipboard_autosync=false'
117-
)
118-
conn = device.shell(start_command, stream=True)
107+
cmds = [
108+
'CLASSPATH=/data/local/tmp/scrcpy_server.jar',
109+
'app_process', '/',
110+
f'com.genymobile.scrcpy.Server', self.version,
111+
'log_level=info', 'max_size=1024', 'max_fps=30',
112+
'video_bit_rate=8000000', 'tunnel_forward=true',
113+
'send_frame_meta='+('true' if self.version == '3.3.3' else 'false'),
114+
f'control={"true" if control else "false"}',
115+
'audio=false', 'show_touches=false', 'stay_awake=false',
116+
'power_off_on_close=false', 'clipboard_autosync=false'
117+
]
118+
conn = device.shell(' '.join(cmds), stream=True)
119119
logger.debug("scrcpy output: %s", conn.conn.recv(100))
120120
return conn # type: ignore
121121

0 commit comments

Comments
 (0)