Functions that provide information about Steam Remote Play sessions, streaming your game content to another computer or to a Steam Link app or hardware.
See
Steam Remote Play for more information.
Member Functions
Member functions for
ISteamRemotePlay
are called through the global accessor function
SteamRemotePlay()
.
GetSessionCount
uint32 GetSessionCount();
Get the number of currently connected Steam Remote Play sessions
Returns: uint32The number of currently connected Steam Remote Play sessions
Example:bool BSteamRemotePlayActive()
{
uint32 unSessionCount = SteamRemotePlay()->GetSessionCount();
for ( uint32 iIndex = 0; iIndex < unSessionCount; iIndex++ )
{
RemotePlaySessionID_t unSessionID = SteamRemotePlay()->GetSessionID( iIndex );
if ( !unSessionID )
{
continue;
}
return true;
}
return false;
}
GetSessionID
RemotePlaySessionID_t GetSessionID( int iSessionIndex );
Name | Type | Description |
iSessionIndex | int | The index of the specified session |
Get the currently connected Steam Remote Play session ID at the specified index
Returns: RemotePlaySessionID_tThe session ID of the session at the specified index, or 0 if the index is less than 0 or greater than or equal to
GetSessionCount()
GetSessionSteamID
CSteamID GetSessionSteamID( RemotePlaySessionID_t unSessionID );
Get the SteamID of the connected user
Returns: CSteamIDThe Steam ID of the user associated with the Remote Play session. This would normally be the logged in user, or a friend in the case of Remote Play Together.
GetSessionClientName
const char *GetSessionClientName( RemotePlaySessionID_t unSessionID );
Get the name of the session client device
Returns: const char *
The name of the device associated with the Remote Play session, or NULL if the session ID is not valid.
GetSessionClientFormFactor
ESteamDeviceFormFactor GetSessionClientFormFactor( RemotePlaySessionID_t unSessionID );
Get the form factor of the session client device
Returns: ESteamDeviceFormFactorThe form factor of the device associated with the Remote Play session, or
k_ESteamDeviceFormFactorUnknown
if the session ID is not valid.
Example:bool BSteamRemotePlayToPhone()
{
uint32 unSessionCount = SteamRemotePlay()->GetSessionCount();
for ( uint32 iIndex = 0; iIndex < unSessionCount; iIndex++ )
{
RemotePlaySessionID_t unSessionID = SteamRemotePlay()->GetSessionID( iIndex );
if ( !unSessionID )
{
continue;
}
ESteamDeviceFormFactor eFormFactor = SteamRemotePlay()->GetSessionClientFormFactor( unSessionID );
if ( eFormFactor == k_ESteamDeviceFormFactorPhone )
{
return true;
}
}
return false;
}
BGetSessionClientResolution
bool BGetSessionClientResolution( RemotePlaySessionID_t unSessionID, int *pnResolutionX, int *pnResolutionY );
Name | Type | Description |
unSessionID | RemotePlaySessionID_t | The session ID to get information about |
pnResolutionX | int | A pointer to a variable to fill with the device resolution width |
pnResolutionY | int | A pointer to a variable to fill with the device resolution height |
Get the resolution, in pixels, of the session client device. This is set to 0x0 if the resolution is not available.
Returns: bool
true if the session ID is valid; otherwise,
false.
Example:// This can return false if the remote device doesn't provide device resolution information
bool BGetSteamRemotePlayResolution( int *pnX, int *pnY )
{
int nMaxResolutionX = 0, nMaxResolutionY = 0;
uint32 unSessionCount = SteamRemotePlay()->GetSessionCount();
for ( uint32 iIndex = 0; iIndex < unSessionCount; iIndex++ )
{
RemotePlaySessionID_t unSessionID = SteamRemotePlay()->GetSessionID( iIndex );
if ( !unSessionID )
{
continue;
}
int nResolutionX = 0, nResolutionY = 0;
SteamRemotePlay()->BGetSessionClientResolution( unSessionID, &nResolutionX, &nResolutionY );
if ( nResolutionX > nMaxResolutionX )
{
nMaxResolutionX = nResolutionX;
nMaxResolutionY = nResolutionY;
}
}
if ( pnX )
{
*pnX = nMaxResolutionX;
}
if ( pnY )
{
*pnY = nMaxResolutionY;
}
return ( nMaxResolutionX > 0 && nMaxResolutionY > 0 );
}
ShowRemotePlayTogetherUI
bool ShowRemotePlayTogetherUI();
Show the Remote Play Together UI in the game overlay.
Returns: bool
true if your game is configured for Remote Play Together; otherwise,
false.
BSendRemotePlayTogetherInvite
bool BSendRemotePlayTogetherInvite( CSteamID steamIDFriend );
Name | Type | Description |
steamIDFriend | CSteamID | The Steam ID of the friend you'd like to invite, or create a guest invite if steamIDFriend is CSteamID() |
Invite a friend to join the game using Remote Play Together
Returns: bool
true if the invite was successfully sent; otherwise,
false.
BEnableRemotePlayTogetherDirectInput
bool BEnableRemotePlayTogetherDirectInput();
Make mouse and keyboard input for Remote Play Together sessions available via GetInput() instead of being merged with local input.
Returns: bool
true if mouse and keyboard events are now available; otherwise,
false.
DisableRemotePlayTogetherDirectInput
void DisableRemotePlayTogetherDirectInput();
Merge Remote Play Together mouse and keyboard input with local input.
GetInput
uint32 GetInput( RemotePlayInput_t *pInput, uint32 unMaxEvents );
Name | Type | Description |
pInput | RemotePlayInput_t | An array of input events that will be filled in by this function, up to unMaxEvents |
unMaxEvents | uint32 | The maximum number of events to read |
Get input events from Remote Play Together sessions. This is available after calling
BEnableRemotePlayTogetherDirectInput().
Returns: uint32The number of events copied to pInput, or the number of events available if pInput is nullptr.
SetMouseVisibility
void SetMouseVisibility( RemotePlaySessionID_t unSessionID, bool bVisible );
Name | Type | Description |
unSessionID | RemotePlaySessionID_t | The session to affect. |
bVisible | bool | True to show the mouse cursor, false to hide it. |
Set the mouse cursor visibility for a remote player. This is available after calling
BEnableRemotePlayTogetherDirectInput().
SetMousePosition
void SetMousePosition( RemotePlaySessionID_t unSessionID, float flNormalizedX, float flNormalizedY );
Name | Type | Description |
unSessionID | RemotePlaySessionID_t | The session to affect. |
flNormalizedX | float | The normalized X position of the mouse cursor. |
flNormalizedY | float | The normalized Y position of the mouse cursor. |
Set the mouse cursor position for a remote player. This is available after calling
BEnableRemotePlayTogetherDirectInput(). This is used to warp the cursor to a specific location and isn't needed during normal event processing. The position is normalized relative to the window, where 0,0 is the upper left, and 1,1 is the lower right.
CreateMouseCursor
RemotePlayCursorID_t CreateMouseCursor( int nWidth, int nHeight, int nHotX, int nHotY, const void *pBGRA, int nPitch = 0 );
Name | Type | Description |
nWidth | int | The width of the cursor, in pixels |
nHeight | int | The height of the cursor, in pixels |
nHotX | int | The X coordinate of the cursor hot spot in pixels, offset from the left of the cursor |
nHotY | int | The Y coordinate of the cursor hot spot in pixels, offset from the top of the cursor |
pBGRA | const void * | A pointer to the cursor pixels, with the color channels in red, green, blue, alpha order |
nPitch | int | The distance between pixel rows in bytes, defaults to nWidth * 4 |
Create a cursor that can be used with SetMouseCursor(). This is available after calling
BEnableRemotePlayTogetherDirectInput().
Returns: RemotePlayCursorID_tSetMouseCursor
void SetMouseCursor( RemotePlaySessionID_t unSessionID, RemotePlayCursorID_t unCursorID );
Set the mouse cursor for a remote player. This is available after calling
BEnableRemotePlayTogetherDirectInput().
Callbacks
These are callbacks which can be fired by calling
SteamAPI_RunCallbacks.
SteamRemotePlaySessionConnected_t
Sent when a client connected to a session.
SteamRemotePlaySessionDisconnected_t
Sent when a client disconnected from a session.
Name | Type | Description |
m_unSessionID | RemotePlaySessionID_t | The session ID of the session that just disconnected |
SteamRemotePlayTogetherGuestInvite_t
Sent when a guest invitation is created, and includes the guest invite URL.
Name | Type | Description |
m_szConnectURL | char * | The URL that can be used to connect to this guest session |
Structs
These are structs which functions in ISteamRemotePlay may return and/or interact with.
RemotePlayInputMouseMotion_t
Mouse motion event data, valid when RemotePlayInput_t::m_eType is k_ERemotePlayInputMouseMotion.
Name | Type | Description |
m_bAbsolute | bool | True if this is absolute mouse motion and m_flNormalizedX and m_flNormalizedY are valid. |
m_flNormalizedX | float | The absolute X position of the mouse, normalized to the display, if m_bAbsolute is true. |
m_flNormalizedY | float | The absolute Y position of the mouse, normalized to the display, if m_bAbsolute is true. |
m_nDeltaX | int | Relative mouse motion in the X direction. |
m_nDeltaY | int | Relative mouse motion in the Y direction. |
RemotePlayInputMouseWheel_t
Mouse wheel event data, valid when RemotePlayInput_t::m_eType is k_ERemotePlayInputMouseWheel.
Name | Type | Description |
m_eDirection | ERemotePlayMouseWheelDirection | The mouse wheel direction. |
m_flAmount | float | 1.0f is a single click of the wheel, 120 units on Windows. |
RemotePlayInputKey_t
Key event data, valid when RemotePlayInput_t::m_eType is k_ERemotePlayInputKeyDown or k_ERemotePlayInputKeyUp.
Name | Type | Description |
m_eScancode | int | Keyboard scancode, common values are defined in ERemotePlayScancode. |
m_unModifiers | uint32 | Mask of ERemotePlayKeyModifier active for this key event. |
m_unKeycode | uint32 | UCS-4 character generated by the keypress, or 0 if it wasn't a character key, e.g. Delete or Left Arrow. |
RemotePlayInput_t
Remote input events, enabled with
BEnableRemotePlayTogetherDirectInput().
Enums
These are enums which are defined for use with ISteamRemotePlay.
ESteamDeviceFormFactor
The form factor of a device
Name | Value | Description |
k_ESteamDeviceFormFactorUnknown | 0 | The device form factor isn't available. |
k_ESteamDeviceFormFactorPhone | 1 | The device is a phone or other small handheld device with touchscreen. |
k_ESteamDeviceFormFactorTablet | 2 | The device is a tablet or other large handheld device with a touchscreen. |
k_ESteamDeviceFormFactorComputer | 3 | The device is a desktop computer or laptop. |
k_ESteamDeviceFormFactorTV | 4 | The device is a TV. |
ERemotePlayInputType
The type of input in
RemotePlayInput_t Name | Value | Description |
k_ERemotePlayInputUnknown | 0 | Unknown input. |
k_ERemotePlayInputMouseMotion | 1 | Mouse motion event. |
k_ERemotePlayInputMouseButtonDown | 2 | Mouse button down event. |
k_ERemotePlayInputMouseButtonUp | 3 | Mouse button up event. |
k_ERemotePlayInputMouseWheel | 4 | Mouse wheel event. |
k_ERemotePlayInputKeyDown | 5 | Keyboard key down event. |
k_ERemotePlayInputKeyUp | 6 | Keyboard key up event. |
ERemotePlayMouseButton
Mouse buttons in
RemotePlayInput_t Name | Value | Description |
k_ERemotePlayMouseButtonLeft | 0x0001 | The left mouse button. |
k_ERemotePlayMouseButtonRight | 0x0002 | The right mouse button. |
k_ERemotePlayMouseButtonMiddle | 0x0010 | The middle mouse button. |
k_ERemotePlayMouseButtonX1 | 0x0020 | The first extended mouse button. |
k_ERemotePlayMouseButtonX2 | 0x0040 | The second extended mouse button. |
ERemotePlayMouseWheelDirection
Mouse wheel direction in
RemotePlayInput_t Name | Value | Description |
k_ERemotePlayMouseWheelUp | 1 | Mouse wheel scrolled away from the user. |
k_ERemotePlayMouseWheelDown | 2 | Mouse wheel scrolled towards the user. |
k_ERemotePlayMouseWheelLeft | 3 | Mouse wheel scrolled to the left. |
k_ERemotePlayMouseWheelRight | 4 | Mouse wheel scrolled to the right. |
ERemotePlayScancode
Key scancode in
RemotePlayInput_tThis is a USB scancode value as defined for the Keyboard/Keypad Page (0x07). This enumeration isn't a complete list, just the most commonly used keys.
Name | Value | Description |
k_ERemotePlayScancodeUnknown | 0 | Unknown key. |
k_ERemotePlayScancodeA | 4 | A |
k_ERemotePlayScancodeB | 5 | B |
k_ERemotePlayScancodeC | 6 | C |
k_ERemotePlayScancodeD | 7 | D |
k_ERemotePlayScancodeE | 8 | E |
k_ERemotePlayScancodeF | 9 | F |
k_ERemotePlayScancodeG | 10 | G |
k_ERemotePlayScancodeH | 11 | H |
k_ERemotePlayScancodeI | 12 | I |
k_ERemotePlayScancodeJ | 13 | J |
k_ERemotePlayScancodeK | 14 | K |
k_ERemotePlayScancodeL | 15 | L |
k_ERemotePlayScancodeM | 16 | M |
k_ERemotePlayScancodeN | 17 | N |
k_ERemotePlayScancodeO | 18 | O |
k_ERemotePlayScancodeP | 19 | P |
k_ERemotePlayScancodeQ | 20 | Q |
k_ERemotePlayScancodeR | 21 | R |
k_ERemotePlayScancodeS | 22 | S |
k_ERemotePlayScancodeT | 23 | T |
k_ERemotePlayScancodeU | 24 | U |
k_ERemotePlayScancodeV | 25 | V |
k_ERemotePlayScancodeW | 26 | W |
k_ERemotePlayScancodeX | 27 | X |
k_ERemotePlayScancodeY | 28 | Y |
k_ERemotePlayScancodeZ | 29 | Z |
k_ERemotePlayScancode1 | 30 | 1 |
k_ERemotePlayScancode2 | 31 | 2 |
k_ERemotePlayScancode3 | 32 | 3 |
k_ERemotePlayScancode4 | 33 | 4 |
k_ERemotePlayScancode5 | 34 | 5 |
k_ERemotePlayScancode6 | 35 | 6 |
k_ERemotePlayScancode7 | 36 | 7 |
k_ERemotePlayScancode8 | 37 | 8 |
k_ERemotePlayScancode9 | 38 | 9 |
k_ERemotePlayScancode0 | 39 | 0 |
k_ERemotePlayScancodeReturn | 40 | Return |
k_ERemotePlayScancodeEscape | 41 | Escape |
k_ERemotePlayScancodeBackspace | 42 | Backspace |
k_ERemotePlayScancodeTab | 43 | Tab |
k_ERemotePlayScancodeSpace | 44 | Space |
k_ERemotePlayScancodeMinus | 45 | Minus |
k_ERemotePlayScancodeEquals | 46 | Equals |
k_ERemotePlayScancodeLeftBracket | 47 | Left Bracket |
k_ERemotePlayScancodeRightBracket | 48 | Right Bracket |
k_ERemotePlayScancodeBackslash | 49 | Backslash |
k_ERemotePlayScancodeSemicolon | 51 | Semicolon |
k_ERemotePlayScancodeApostrophe | 52 | Apostrophe |
k_ERemotePlayScancodeGrave | 53 | Grave |
k_ERemotePlayScancodeComma | 54 | Comma |
k_ERemotePlayScancodePeriod | 55 | Period |
k_ERemotePlayScancodeSlash | 56 | Slash |
k_ERemotePlayScancodeCapsLock | 57 | CapsLock |
k_ERemotePlayScancodeF1 | 58 | F1 |
k_ERemotePlayScancodeF2 | 59 | F2 |
k_ERemotePlayScancodeF3 | 60 | F3 |
k_ERemotePlayScancodeF4 | 61 | F4 |
k_ERemotePlayScancodeF5 | 62 | F5 |
k_ERemotePlayScancodeF6 | 63 | F6 |
k_ERemotePlayScancodeF7 | 64 | F7 |
k_ERemotePlayScancodeF8 | 65 | F8 |
k_ERemotePlayScancodeF9 | 66 | F9 |
k_ERemotePlayScancodeF10 | 67 | F10 |
k_ERemotePlayScancodeF11 | 68 | F11 |
k_ERemotePlayScancodeF12 | 69 | F12 |
k_ERemotePlayScancodeInsert | 73 | Insert |
k_ERemotePlayScancodeHome | 74 | Home |
k_ERemotePlayScancodePageUp | 75 | Page Up |
k_ERemotePlayScancodeDelete | 76 | Delete |
k_ERemotePlayScancodeEnd | 77 | End |
k_ERemotePlayScancodePageDown | 78 | Page Down |
k_ERemotePlayScancodeRight | 79 | Right |
k_ERemotePlayScancodeLeft | 80 | Left |
k_ERemotePlayScancodeDown | 81 | Down |
k_ERemotePlayScancodeUp | 82 | Up |
k_ERemotePlayScancodeLeftControl | 224 | Left Control |
k_ERemotePlayScancodeLeftShift | 225 | Left Shift |
k_ERemotePlayScancodeLeftAlt | 226 | Left Alt |
k_ERemotePlayScancodeLeftGUI | 227 | Left GUI (windows, command, meta, etc.) |
k_ERemotePlayScancodeRightControl | 228 | Right Control |
k_ERemotePlayScancodeRightShift | 229 | Right Shift |
k_ERemotePlayScancodeRightALT | 230 | Right ALT |
k_ERemotePlayScancodeRightGUI | 231 | Right GUI (windows, command, meta, etc.) |
ERemotePlayKeyModifier
Key modifier in
RemotePlayInput_t Name | Value | Description |
k_ERemotePlayKeyModifierNone | 0x0000 | No modifiers are active. |
k_ERemotePlayKeyModifierLeftShift | 0x0001 | Left shift is active. |
k_ERemotePlayKeyModifierRightShift | 0x0002 | Right shift is active. |
k_ERemotePlayKeyModifierLeftControl | 0x0040 | Left control is active. |
k_ERemotePlayKeyModifierRightControl | 0x0080 | Right control is active. |
k_ERemotePlayKeyModifierLeftAlt | 0x0100 | Left Alt is active. |
k_ERemotePlayKeyModifierRightAlt | 0x0200 | Right Alt is active. |
k_ERemotePlayKeyModifierLeftGUI | 0x0400 | Left GUI is active. |
k_ERemotePlayKeyModifierRightGUI | 0x0800 | Right GUI is active. |
k_ERemotePlayKeyModifierNumLock | 0x1000 | NumLock is active. |
k_ERemotePlayKeyModifierCapsLock | 0x2000 | CapsLock is active. |
k_ERemotePlayKeyModifierMask | 0xFFFF | A mask of all modifiers. |
Typedefs
These are typedefs which are defined for use with ISteamRemotePlay.
Name | Base type | Description |
RemotePlaySessionID_t | uint32 | A Steam Remote Play session ID. |
RemotePlayCursorID_t | uint32 | A Steam Remote Play mouse cursor ID. |