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.
Parameter |
Type |
Default |
Description |
---|---|---|---|
user |
|
<required> |
|
profiles |
None |
||
loop |
|
None |
The asyncio Event Loop to use.
Must be running. Generally not needed.
If not specified, the current
running loop will be used.
|
receiver |
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 |
|
720p |
The resolution to use for video stream.
Must be one of
[“360p”, “540p”, “720p”, “1080p”].
|
fps |
|
low |
The FPS / frame rate for the video stream.
Can be expressed as
[“low”, “high”] or [30, 60].
|
quality |
|
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 |
|
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 |
|
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.