@@ -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