Steamworks Documentation
ISteamRemotePlay Interface
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: uint32
The 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 );
NameTypeDescription
iSessionIndexintThe index of the specified session

Get the currently connected Steam Remote Play session ID at the specified index

Returns: RemotePlaySessionID_t
The 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 );
NameTypeDescription
unSessionIDRemotePlaySessionID_tThe session ID to get information about

Get the SteamID of the connected user

Returns: CSteamID
The 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 );
NameTypeDescription
unSessionIDRemotePlaySessionID_tThe session ID to get information about

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 );
NameTypeDescription
unSessionIDRemotePlaySessionID_tThe session ID to get information about

Get the form factor of the session client device

Returns: ESteamDeviceFormFactor
The 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 );
NameTypeDescription
unSessionIDRemotePlaySessionID_tThe session ID to get information about
pnResolutionXintA pointer to a variable to fill with the device resolution width
pnResolutionYintA 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 );
NameTypeDescription
steamIDFriendCSteamIDThe 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 );
NameTypeDescription
pInputRemotePlayInput_tAn array of input events that will be filled in by this function, up to unMaxEvents
unMaxEventsuint32The maximum number of events to read

Get input events from Remote Play Together sessions. This is available after calling BEnableRemotePlayTogetherDirectInput().


Returns: uint32
The number of events copied to pInput, or the number of events available if pInput is nullptr.

SetMouseVisibility

void SetMouseVisibility( RemotePlaySessionID_t unSessionID, bool bVisible );
NameTypeDescription
unSessionIDRemotePlaySessionID_tThe session to affect.
bVisibleboolTrue 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 );
NameTypeDescription
unSessionID RemotePlaySessionID_tThe session to affect.
flNormalizedXfloatThe normalized X position of the mouse cursor.
flNormalizedYfloatThe 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 );
NameTypeDescription
nWidthintThe width of the cursor, in pixels
nHeightintThe height of the cursor, in pixels
nHotXintThe X coordinate of the cursor hot spot in pixels, offset from the left of the cursor
nHotYintThe Y coordinate of the cursor hot spot in pixels, offset from the top of the cursor
pBGRAconst void *A pointer to the cursor pixels, with the color channels in red, green, blue, alpha order
nPitchintThe 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_t

SetMouseCursor

void SetMouseCursor( RemotePlaySessionID_t unSessionID, RemotePlayCursorID_t unCursorID );
NameTypeDescription
unSessionID RemotePlaySessionID_tThe session to affect.
unCursorIDRemotePlayCursorID_tThe normalized X position of the mouse cursor.

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.

NameTypeDescription
m_unSessionIDRemotePlaySessionID_tThe session ID of the session that just connected

SteamRemotePlaySessionDisconnected_t

Sent when a client disconnected from a session.

NameTypeDescription
m_unSessionIDRemotePlaySessionID_tThe session ID of the session that just disconnected

SteamRemotePlayTogetherGuestInvite_t

Sent when a guest invitation is created, and includes the guest invite URL.

NameTypeDescription
m_szConnectURLchar *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.

NameTypeDescription
m_bAbsoluteboolTrue if this is absolute mouse motion and m_flNormalizedX and m_flNormalizedY are valid.
m_flNormalizedXfloatThe absolute X position of the mouse, normalized to the display, if m_bAbsolute is true.
m_flNormalizedYfloat The absolute Y position of the mouse, normalized to the display, if m_bAbsolute is true.
m_nDeltaXintRelative mouse motion in the X direction.
m_nDeltaYintRelative mouse motion in the Y direction.

RemotePlayInputMouseWheel_t

Mouse wheel event data, valid when RemotePlayInput_t::m_eType is k_ERemotePlayInputMouseWheel.

NameTypeDescription
m_eDirectionERemotePlayMouseWheelDirectionThe mouse wheel direction.
m_flAmountfloat1.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.

NameTypeDescription
m_eScancodeintKeyboard scancode, common values are defined in ERemotePlayScancode.
m_unModifiersuint32Mask of ERemotePlayKeyModifier active for this key event.
m_unKeycodeuint32UCS-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().

NameTypeDescription
m_unSessionIDRemotePlayInput_tThe session that sent this input.
m_eTypeERemotePlayInputTypeThe type of input in this event.
m_MouseMotionRemotePlayInputMouseMotion_tMouse motion event data, valid when m_eType is k_ERemotePlayInputMouseMotion.
m_eMouseButtonERemotePlayMouseButtonMouse button event data, valid when m_eType is k_ERemotePlayInputMouseButtonDown or k_ERemotePlayInputMouseButtonUp.
m_MouseWheelRemotePlayInputMouseWheel_tMouse wheel event data, valid when m_eType is k_ERemotePlayInputMouseWheel.
m_KeyRemotePlayInputKey_tKey event data, valid when m_eType is k_ERemotePlayInputKeyDown or k_ERemotePlayInputKeyUp.

Enums

These are enums which are defined for use with ISteamRemotePlay.

ESteamDeviceFormFactor

The form factor of a device

NameValueDescription
k_ESteamDeviceFormFactorUnknown0The device form factor isn't available.
k_ESteamDeviceFormFactorPhone1The device is a phone or other small handheld device with touchscreen.
k_ESteamDeviceFormFactorTablet2The device is a tablet or other large handheld device with a touchscreen.
k_ESteamDeviceFormFactorComputer3The device is a desktop computer or laptop.
k_ESteamDeviceFormFactorTV4The device is a TV.

ERemotePlayInputType

The type of input in RemotePlayInput_t

NameValueDescription
k_ERemotePlayInputUnknown0Unknown input.
k_ERemotePlayInputMouseMotion1Mouse motion event.
k_ERemotePlayInputMouseButtonDown2Mouse button down event.
k_ERemotePlayInputMouseButtonUp3Mouse button up event.
k_ERemotePlayInputMouseWheel4Mouse wheel event.
k_ERemotePlayInputKeyDown5Keyboard key down event.
k_ERemotePlayInputKeyUp6Keyboard key up event.

ERemotePlayMouseButton

Mouse buttons in RemotePlayInput_t

NameValueDescription
k_ERemotePlayMouseButtonLeft0x0001The left mouse button.
k_ERemotePlayMouseButtonRight0x0002The right mouse button.
k_ERemotePlayMouseButtonMiddle0x0010The middle mouse button.
k_ERemotePlayMouseButtonX10x0020The first extended mouse button.
k_ERemotePlayMouseButtonX20x0040The second extended mouse button.

ERemotePlayMouseWheelDirection

Mouse wheel direction in RemotePlayInput_t

NameValueDescription
k_ERemotePlayMouseWheelUp1Mouse wheel scrolled away from the user.
k_ERemotePlayMouseWheelDown2Mouse wheel scrolled towards the user.
k_ERemotePlayMouseWheelLeft3Mouse wheel scrolled to the left.
k_ERemotePlayMouseWheelRight4Mouse wheel scrolled to the right.

ERemotePlayScancode

Key scancode in RemotePlayInput_t

This 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.

NameValueDescription
k_ERemotePlayScancodeUnknown0Unknown key.
k_ERemotePlayScancodeA4A
k_ERemotePlayScancodeB5B
k_ERemotePlayScancodeC6C
k_ERemotePlayScancodeD7D
k_ERemotePlayScancodeE8E
k_ERemotePlayScancodeF9F
k_ERemotePlayScancodeG10G
k_ERemotePlayScancodeH11H
k_ERemotePlayScancodeI12I
k_ERemotePlayScancodeJ13J
k_ERemotePlayScancodeK14K
k_ERemotePlayScancodeL15L
k_ERemotePlayScancodeM16M
k_ERemotePlayScancodeN17N
k_ERemotePlayScancodeO18O
k_ERemotePlayScancodeP19P
k_ERemotePlayScancodeQ20Q
k_ERemotePlayScancodeR21R
k_ERemotePlayScancodeS22S
k_ERemotePlayScancodeT23T
k_ERemotePlayScancodeU24U
k_ERemotePlayScancodeV25V
k_ERemotePlayScancodeW26W
k_ERemotePlayScancodeX27X
k_ERemotePlayScancodeY28Y
k_ERemotePlayScancodeZ29Z
k_ERemotePlayScancode1301
k_ERemotePlayScancode2312
k_ERemotePlayScancode3323
k_ERemotePlayScancode4334
k_ERemotePlayScancode5345
k_ERemotePlayScancode6356
k_ERemotePlayScancode7367
k_ERemotePlayScancode8378
k_ERemotePlayScancode9389
k_ERemotePlayScancode0390
k_ERemotePlayScancodeReturn40Return
k_ERemotePlayScancodeEscape41Escape
k_ERemotePlayScancodeBackspace42Backspace
k_ERemotePlayScancodeTab43Tab
k_ERemotePlayScancodeSpace44Space
k_ERemotePlayScancodeMinus45Minus
k_ERemotePlayScancodeEquals46Equals
k_ERemotePlayScancodeLeftBracket47Left Bracket
k_ERemotePlayScancodeRightBracket48Right Bracket
k_ERemotePlayScancodeBackslash49Backslash
k_ERemotePlayScancodeSemicolon51Semicolon
k_ERemotePlayScancodeApostrophe52Apostrophe
k_ERemotePlayScancodeGrave53Grave
k_ERemotePlayScancodeComma54Comma
k_ERemotePlayScancodePeriod55Period
k_ERemotePlayScancodeSlash56Slash
k_ERemotePlayScancodeCapsLock57CapsLock
k_ERemotePlayScancodeF158F1
k_ERemotePlayScancodeF259F2
k_ERemotePlayScancodeF360F3
k_ERemotePlayScancodeF461F4
k_ERemotePlayScancodeF562F5
k_ERemotePlayScancodeF663F6
k_ERemotePlayScancodeF764F7
k_ERemotePlayScancodeF865F8
k_ERemotePlayScancodeF966F9
k_ERemotePlayScancodeF1067F10
k_ERemotePlayScancodeF1168F11
k_ERemotePlayScancodeF1269F12
k_ERemotePlayScancodeInsert73Insert
k_ERemotePlayScancodeHome74Home
k_ERemotePlayScancodePageUp75Page Up
k_ERemotePlayScancodeDelete76Delete
k_ERemotePlayScancodeEnd77End
k_ERemotePlayScancodePageDown78Page Down
k_ERemotePlayScancodeRight79Right
k_ERemotePlayScancodeLeft80Left
k_ERemotePlayScancodeDown81Down
k_ERemotePlayScancodeUp82Up
k_ERemotePlayScancodeLeftControl224Left Control
k_ERemotePlayScancodeLeftShift225Left Shift
k_ERemotePlayScancodeLeftAlt226Left Alt
k_ERemotePlayScancodeLeftGUI227Left GUI (windows, command, meta, etc.)
k_ERemotePlayScancodeRightControl228Right Control
k_ERemotePlayScancodeRightShift229Right Shift
k_ERemotePlayScancodeRightALT230Right ALT
k_ERemotePlayScancodeRightGUI231Right GUI (windows, command, meta, etc.)

ERemotePlayKeyModifier

Key modifier in RemotePlayInput_t

NameValueDescription
k_ERemotePlayKeyModifierNone0x0000No modifiers are active.
k_ERemotePlayKeyModifierLeftShift0x0001Left shift is active.
k_ERemotePlayKeyModifierRightShift0x0002Right shift is active.
k_ERemotePlayKeyModifierLeftControl0x0040Left control is active.
k_ERemotePlayKeyModifierRightControl0x0080Right control is active.
k_ERemotePlayKeyModifierLeftAlt0x0100Left Alt is active.
k_ERemotePlayKeyModifierRightAlt0x0200Right Alt is active.
k_ERemotePlayKeyModifierLeftGUI0x0400Left GUI is active.
k_ERemotePlayKeyModifierRightGUI0x0800Right GUI is active.
k_ERemotePlayKeyModifierNumLock0x1000NumLock is active.
k_ERemotePlayKeyModifierCapsLock0x2000CapsLock is active.
k_ERemotePlayKeyModifierMask0xFFFFA mask of all modifiers.

Typedefs

These are typedefs which are defined for use with ISteamRemotePlay.

NameBase typeDescription
RemotePlaySessionID_tuint32A Steam Remote Play session ID.
RemotePlayCursorID_tuint32A Steam Remote Play mouse cursor ID.