Skip to content

Latest commit

 

History

History
118 lines (93 loc) · 4.69 KB

session.rst

File metadata and controls

118 lines (93 loc) · 4.69 KB

Sessions

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

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

A RPDevice <pyremoteplay.device.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() <pyremoteplay.device.RPDevice.create_session>

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

Parameters for RPDevice.create_session() <pyremoteplay.device.RPDevice.create_session>
Parameter Type Default Description
user str <str> <required>
The username / PSN ID to connect with.
A list of users can be found with
RPDevice.get_users() <pyremoteplay.device.RPDevice.get_users>.
profiles Profiles <pyremoteplay.profile.Profiles> None
A profiles object. Generally not needed
as the RPDevice <pyremoteplay.device.RPDevice> class will
pass this to Session.
loop asyncio.AbstractEventLoop <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 <pyremoteplay.receiver.AVReceiver> None
The receiver to use.
Note: Must be a sub-class of
AVReceiver; See QueueReceiver <pyremoteplay.receiver.QueueReceiver>.
The receiver exposes audio and video
frames from the live stream.
If not provided then no video/audio
will be processed.
resolution Resolution <pyremoteplay.const.Resolution> or str <str> or int <int> 720p
The resolution to use for video stream.
Must be one of
["360p", "540p", "720p", "1080p"].
fps FPS <pyremoteplay.const.FPS> or str <str> or int <int> low
The FPS / frame rate for the video stream.
Can be expressed as
["low", "high"] or [30, 60].
quality Quality <pyremoteplay.const.Quality> or str <str> or int <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 <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 <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() <pyremoteplay.device.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() <pyremoteplay.device.RPDevice.wait_for_session> method or the RPDevice.async_wait_for_session() <pyremoteplay.device.RPDevice.async_wait_for_session> coroutine.

The RPDevice.ready <pyremoteplay.device.RPDevice.ready> property will return True if the Session is ready.

Disconnecting from a Session

To disconnect, simply call the RPDevice.disconnect() <pyremoteplay.device.RPDevice.disconnect> method.

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