pyremoteplay.session module

Remote Play Session.

class pyremoteplay.session.Session(host, profile, loop=None, receiver=None, resolution='720p', fps='low', quality='default', codec='h264', hdr=False)

Bases: object

Remote Play Session Async.

Parameters
  • host (str) – IP Address of Remote Play Host

  • profile (Union[dict, UserProfile]) – User Profile to connect with

  • loop (Optional[AbstractEventLoop]) – A running asyncio event loop. If None, loop will be the current running loop

  • receiver (Optional[AVReceiver]) – A receiver for handling video and audio frames

  • resolution (Union[Resolution, str, int]) – The resolution of video stream. Name of or value of or Resolution enum

  • fps (Union[FPS, str, int]) – Frames per second for video stream. Name of or value of or FPS enum

  • quality (Union[Quality, str, int]) – Quality of video stream. Name of or value of or Quality enum

  • codec (str) – Name of FFMPEG video codec to use. i.e. ‘h264’, ‘h264_cuvid’. Video codec should be ‘h264’ or ‘hevc’. PS4 hosts will always use h264.

  • hdr (bool) – Uses HDR if True. Has no effect if codec is ‘h264’

HEADER_LENGTH = 8
class State(value)

Bases: IntEnum

State Enums.

INIT = 1
RUNNING = 2
READY = 3
STOP = 4
class MessageType(value)

Bases: IntEnum

Enum for Message Types.

LOGIN_PIN_REQUEST = 4
LOGIN_PIN_RESPONSE = 32772
LOGIN = 5
SESSION_ID = 51
HEARTBEAT_REQUEST = 254
HEARTBEAT_RESPONSE = 510
STANDBY = 80
KEYBOARD_ENABLE_TOGGLE = 32
KEYBOARD_OPEN = 33
KEYBOARD_CLOSE_REMOTE = 34
KEYBOARD_TEXT_CHANGE_REQ = 35
KEYBOARD_TEXT_CHANGE_RES = 36
KEYBOARD_CLOSE_REQ = 37
class ServerType(value)

Bases: IntEnum

Server Type Enum.

UNKNOWN = -1
PS4 = 0
PS4_PRO = 1
PS5 = 2
standby(timeout=3.0)

Set host to standby. Blocking. Return True if successful.

Parameters

timeout – Timeout in seconds

Return type

bool

async async_standby(timeout=3.0)

Set host to standby. Return True if successful.

Parameters

timeout – Timeout in seconds

Return type

bool

async start(wakeup=True, autostart=True)

Start Session/RP Session.

Return type

bool

stop()

Stop Session.

set_receiver(receiver)

Set AV Receiver. Should be set before starting session.

wait(timeout=5)

Wait for session to be ready. Return True if session becomes ready.

Blocks until timeout exceeded or when session is ready.

Parameters

timeout (Union[float, int]) – Timeout in seconds.

Return type

bool

async async_wait(timeout=5)

Wait for session to be ready. Return True if session becomes ready.

Waits until timeout exceeded or when session is ready.

Parameters

timeout (Union[float, int]) – Timeout in seconds.

Return type

bool

property host: str

Return host address.

Return type

str

property type: str

Return host type.

Return type

str

property state: State

Return State.

Return type

State

property is_ready: bool

Return True if ready for user interaction.

Return type

bool

property is_running: bool

Return True if running.

Return type

bool

property is_stopped: bool

Return True if stopped.

Return type

bool

property session_id: bytes

Return Session ID.

Return type

bytes

property stream: RPStream

Return Stream.

Return type

RPStream

property stop_event: Event

Return Stop Event.

Return type

Event

property resolution: Resolution

Return resolution.

Return type

Resolution

property quality: Quality

Return Quality.

Return type

Quality

property fps: FPS

Return FPS.

Return type

FPS

property codec: str

Return video codec.

Return type

str

property hdr: bool

Return True if HDR.

Return type

bool

property stream_type: StreamType

Return Stream Type.

Return type

StreamType

property server_type: ServerType

Return Server Type.

Return type

ServerType

property receiver: AVReceiver

Return AV Receiver.

Return type

AVReceiver

property events: ExecutorEventEmitter

Return Event Emitter.

Return type

ExecutorEventEmitter

property loop: AbstractEventLoop

Return loop.

Return type

AbstractEventLoop