Sessions

The Session class is responsible for connecting to a Remote Play session.

It is recommended to create a Session using the RPDevice.create_session(), method instead of creating it directly.

A RPDevice instance can only have one Session instance coupled to it at a time.

There are multiple parameters for creating a session which will configure options such as frame rate and the resolution of the video stream.

Creating a Session

The following are parameters for RPDevice.create_session()

The only required argument is user. The remaining arguments should be passed as keyword arguments.

Parameters for RPDevice.create_session()

Parameter

Type

Default

Description

user

str

<required>

The username / PSN ID to connect with.
A list of users can be found with

profiles

Profiles

None

A profiles object. Generally not needed
as the RPDevice class will
pass this to Session.

loop

asyncio.AbstractEventLoop

None

The asyncio Event Loop to use.
Must be running. Generally not needed.
If not specified, the current
running loop will be used.

receiver

AVReceiver

None

The receiver to use.
Note: Must be a sub-class of
AVReceiver; See QueueReceiver.
The receiver exposes audio and video
frames from the live stream.
If not provided then no video/audio
will be processed.

resolution

Resolution or str or int

720p

The resolution to use for video stream.
Must be one of
[“360p”, “540p”, “720p”, “1080p”].

fps

FPS or str or int

low

The FPS / frame rate for the video stream.
Can be expressed as
[“low”, “high”] or [30, 60].

quality

Quality or str or int

default

The quality of the video stream.
Represents the bitrate of the stream.
Must be a valid member of the Quality enum.
Using DEFAULT will use the appropriate
bitrate for a specific resolution.

codec

str

h264

The FFMPEG video codec to use.
Valid codecs start with either “h264” or “hevc”.
There are several FFMPEG Hardware Decoding
codecs that can be used such as “h264_cuvid”.
On devices which do not support “hevc”,
“h264” will always be used.

hdr

bool

False

Whether HDR should be used for the video stream.
This is only used with the “hevc” codec.

Connecting to a Session

To connect to a created session, use the async coroutine RPDevice.connect().

After connecting, one should wait for it to be ready before using it. This can be done with the RPDevice.wait_for_session() method or the RPDevice.async_wait_for_session() coroutine.

The RPDevice.ready property will return True if the Session is ready.

Disconnecting from a Session

To disconnect, simply call the RPDevice.disconnect() method.

Note: This will also destroy the Session object and the RPDevice.session property will be set to None.