API¶
Module description¶
Python Scrcpy Client’s core module
Submodules¶
scrcpy.core module¶
- class scrcpy.core.Client(device: Optional[Union[adbutils._device.AdbDevice, str, any]] = None, max_width: int = 0, bitrate: int = 8000000, max_fps: int = 0, flip: bool = False, block_frame: bool = False, stay_awake: bool = False, lock_screen_orientation: int = - 1, connection_timeout: int = 3000, encoder_name: Optional[str] = None)[source]¶
Bases:
object
- add_listener(cls: str, listener: Callable[[...], Any]) None [source]¶
Add a video listener
- Parameters
cls – Listener category, support: init, frame
listener – A function to receive frame np.ndarray
- remove_listener(cls: str, listener: Callable[[...], Any]) None [source]¶
Remove a video listener
- Parameters
cls – Listener category, support: init, frame
listener – A function to receive frame np.ndarray
scrcpy.control module¶
- class scrcpy.control.ControlSender(parent)[source]¶
Bases:
object
- back_or_turn_screen_on(action: int = 0) bytes [source]¶
If the screen is off, it is turned on only on ACTION_DOWN
- Parameters
action – ACTION_DOWN | ACTION_UP
- keycode(keycode: int, action: int = 0, repeat: int = 0) bytes [source]¶
Send keycode to device
- Parameters
keycode – const.KEYCODE_*
action – ACTION_DOWN | ACTION_UP
repeat – repeat count
- scroll(x: int, y: int, h: int, v: int) bytes [source]¶
Scroll screen
- Parameters
x – horizontal position
y – vertical position
h – horizontal movement
v – vertical movement
- set_clipboard(text: str, paste: bool = False) bytes [source]¶
Set clipboard
- Parameters
text – the string you want to set
paste – paste now
- set_screen_power_mode(mode: int = 2) bytes [source]¶
Set screen power mode
- Parameters
mode – POWER_MODE_OFF | POWER_MODE_NORMAL
- swipe(start_x: int, start_y: int, end_x: int, end_y: int, move_step_length: int = 5, move_steps_delay: float = 0.005) None [source]¶
Swipe on screen
- Parameters
start_x – start horizontal position
start_y – start vertical position
end_x – start horizontal position
end_y – end vertical position
move_step_length – length per step
move_steps_delay – sleep seconds after each step
- Returns
scrcpy.const module¶
This module includes all consts used in this project