### Client with Screen Sharing Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/examples/client.rst Establishes a client connection and enables screen sharing. This example requires additional setup for the server to handle screen data. ```python from pyremoteplay.client import Client client = Client(host="127.0.0.1", port=5000, enable_screen_sharing=True) client.connect() # Screen sharing is enabled by default upon connection if configured # Further actions can be performed here client.disconnect() ``` -------------------------------- ### Create and Use a QueueReceiver Session Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/live_stream.rst This example demonstrates how to initialize an RPDevice, retrieve user information, create a QueueReceiver instance, and start a session with the device using the receiver. ```Python from pyremoteplay import RPDevice from pyremoteplay.receiver import QueueReceiver ip_address = "192.168.86.2" device = RPDevice(ip_address) device.get_status() user = device.get_users()[0] receiver = QueueReceiver() device.create_session(user, receiver=receiver) ``` -------------------------------- ### Install pyremoteplay from Source Source: https://github.com/ktnrg45/pyremoteplay/blob/master/README.md Steps to install the library directly from its source code repository. ```bash pip install -r requirements.txt python setup.py install ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/ktnrg45/pyremoteplay/blob/master/README.md Recommended steps to set up a virtual environment for installing the library. ```bash python3 -m venv . source bin/activate ``` -------------------------------- ### Install GUI Dependencies from Source Source: https://github.com/ktnrg45/pyremoteplay/blob/master/README.md Install additional dependencies required for the GUI when installing from source. ```bash pip install -r requirements-gui.txt ``` -------------------------------- ### Install pyremoteplay with GUI Support Source: https://github.com/ktnrg45/pyremoteplay/blob/master/README.md Install pyremoteplay along with optional GUI dependencies. ```bash pip install pyremoteplay[gui] ``` -------------------------------- ### Async Client Example Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/examples/async_client.rst Demonstrates basic usage of the asynchronous client, including connecting, sending commands, and receiving responses. Ensure the client is properly initialized before use. ```python import asyncio from pyremoteplay.async_client import RemotePlayClient async def main(): async with RemotePlayClient("127.0.0.1", 5000) as client: await client.send_command("hello") response = await client.receive_response() print(f"Received: {response}") if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### CLI Setup for Host Registration Source: https://github.com/ktnrg45/pyremoteplay/blob/master/README.md Command to initiate the registration process for a Remote Play host via the CLI. ```bash pyremoteplay {host IP Address} --register ``` -------------------------------- ### Install pyremoteplay Core Package Source: https://github.com/ktnrg45/pyremoteplay/blob/master/README.md Install the main pyremoteplay package using pip. ```bash pip install pyremoteplay ``` -------------------------------- ### PyRemotePlay Gamepad Example Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/examples/gamepad.rst This snippet demonstrates the basic integration of gamepad support within PyRemotePlay. It relies on the Pygame library for handling joystick input. ```python import pyremoteplay # Initialize Pygame and the gamepad module # pyremoteplay.gamepad.init() # You can then access gamepad events and states # For example, to check if a button is pressed: # if pyremoteplay.gamepad.is_button_pressed(0, 0): # print("Button 0 pressed on gamepad 0") # Remember to quit the gamepad module when done # pyremoteplay.gamepad.quit() ``` -------------------------------- ### Enable Hardware Decoding for pyav Source: https://github.com/ktnrg45/pyremoteplay/blob/master/README.md Command to install the 'av' package with support for hardware decoding, potentially requiring system-level ffmpeg installation. ```bash pip install av --no-binary av ``` -------------------------------- ### Run GUI Application Source: https://github.com/ktnrg45/pyremoteplay/blob/master/README.md Command to launch the pyremoteplay graphical user interface. ```bash pyremoteplay-gui ``` -------------------------------- ### Helper Method for New User Registration Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/registering.rst An alternative helper method to register a new user and save their profile. It simplifies the process of retrieving and saving account information. ```python profiles.new_user(redirect_url, save=True) ``` -------------------------------- ### Basic Client Connection and Control Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/examples/client.rst Connects to a remote server and demonstrates basic control operations like sending key presses and mouse movements. Ensure the server is running and accessible. ```python from pyremoteplay.client import Client client = Client(host="127.0.0.1", port=5000) # Connect to the server client.connect() # Send a key press (e.g., 'a' key) client.send_key_press("a") # Send a mouse movement (relative) client.send_mouse_move(dx=10, dy=5) # Send a mouse click (left button) client.send_mouse_click("left") # Disconnect from the server client.disconnect() ``` -------------------------------- ### Client with Both Screen and Audio Sharing Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/examples/client.rst Connects to a remote server enabling both screen and audio sharing. This is useful for full remote control and monitoring scenarios. ```python from pyremoteplay.client import Client client = Client(host="127.0.0.1", port=5000, enable_screen_sharing=True, enable_audio_sharing=True) client.connect() # Both screen and audio sharing are enabled # Further actions can be performed here client.disconnect() ``` -------------------------------- ### Create RPDevice Instance Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/device.rst Manually create an RPDevice instance using its IP address or hostname. This does not verify if the host is a Remote Play device. ```python from pyremoteplay import RPDevice device = RPDevice("192.168.86.2") device2 = RPDevice("my_device_hostname") ``` -------------------------------- ### Client with Audio Sharing Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/examples/client.rst Connects to a remote server with audio sharing enabled. This requires the server to be configured to receive and process audio streams. ```python from pyremoteplay.client import Client client = Client(host="127.0.0.1", port=5000, enable_audio_sharing=True) client.connect() # Audio sharing is enabled by default upon connection if configured # Further actions can be performed here client.disconnect() ``` -------------------------------- ### Run Terminal-Only CLI Source: https://github.com/ktnrg45/pyremoteplay/blob/master/README.md Command to launch the command-line interface without the GUI. ```bash pyremoteplay {host IP Address} ``` -------------------------------- ### Xbox 360 Gamepad Mapping (YAML) Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/examples/gamepad.rst This YAML file defines the mapping for an Xbox 360 controller. Custom mappings like this are necessary for controllers not automatically supported by PyRemotePlay. ```yaml name: Xbox 360 Controller # Axes left_stick_x: 0 left_stick_y: 1 right_stick_x: 3 right_stick_y: 4 left_trigger: 2 right_trigger: 5 # Buttons button_south: 1 button_east: 2 button_west: 0 button_north: 3 left_shoulder: 4 right_shoulder: 5 button_select: 8 button_start: 9 button_dpad_up: 10 button_dpad_down: 12 button_dpad_left: 13 button_dpad_right: 11 button_a: 0 button_b: 1 button_x: 2 button_y: 3 button_guide: 16 ``` -------------------------------- ### DualShock 4 Gamepad Mapping (YAML) Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/examples/gamepad.rst This YAML file defines the mapping for a DualShock 4 controller. PyRemotePlay automatically detects and applies this mapping for compatible controllers. ```yaml name: DualShock 4 # Axes left_stick_x: 0 left_stick_y: 1 right_stick_x: 3 right_stick_y: 4 left_trigger: 2 right_trigger: 5 # Buttons button_south: 1 button_east: 2 button_west: 0 button_north: 3 left_shoulder: 4 right_shoulder: 5 button_select: 6 button_start: 7 button_dpad_up: 10 button_dpad_down: 12 button_dpad_left: 13 button_dpad_right: 11 button_a: 8 button_b: 9 button_x: 14 button_y: 15 button_guide: 16 ``` -------------------------------- ### Retrieve and Save PSN Account Info Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/registering.rst This snippet shows how to retrieve PSN account information and save it for future use. It requires user interaction via a web browser for login. This step only needs to be performed once per PSN user. ```python from pyremoteplay import RPDevice from pyremoteplay import oauth # This is the url that users will need to sign in # Must be done in a web browser url = oauth.get_login_url() # User should be redirected to a page that says 'redirect' # Have the user supply the url of this page account = oauth.get_account_info(redirect_url) # Format Account to User Profile user_profile = oauth.format_user_account(account) # User Profile should be saved for future use profiles = RPDevice.get_profiles() profiles.update_user(user_profile) profiles.save() ``` -------------------------------- ### Link PSN Account to Remote Play Device Source: https://github.com/ktnrg45/pyremoteplay/blob/master/docs/source/registering.rst This snippet demonstrates how to link a PSN user profile to a specific Remote Play device. Linking must be performed once for each device per user and requires a linking PIN obtained from the device's Remote Play settings. The device must have a valid status before registration. ```python ip_address = '192.169.0.2' device = RPDevice(ip_address) device.get_status() # Device needs a valid status device.register(user_profile.name, pin, save=True) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.