### Demo: Using pyscrcpy Client with callback and threaded loop Source: https://github.com/yixinnb/pyscrcpy/blob/main/README.md Shows two usage patterns for the pyscrcpy Client. demo1 uses a callback with on_frame to handle frames and touch input, while demo2 starts a threaded client and polls last_frame in a loop. Both require OpenCV (cv2) for display. ```python import cv2 as cv from pyscrcpy import Client # import scrcpy client def on_frame(client, frame): client.control.touch(300,500)# emulate touch on(300,500) cv.imshow('Video', frame) cv.waitKey(1) def demo1(): client = Client(max_fps=1, max_size=900) client.on_frame(on_frame) client.start() def demo2(): client = Client(max_fps=20) client.start(threaded=True) # create a new thread for scrcpy while 1: if client.last_frame is None: continue on_frame(client, client.last_frame) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.