Skip to content

Commit 05bebea

Browse files
[UE5.7] Exposed playerid (#728) (#729)
* Exposed playerid (#728) (cherry picked from commit 6733632) * Expose player id and improve signalling library Add ability to access player id on the frontend and remove player id stripping from the signalling library. This change backports the 'Exposed playerid' feature. --------- Co-authored-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com>
1 parent e741e03 commit 05bebea

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.changeset/bright-shoes-repair.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@epicgames-ps/lib-pixelstreamingfrontend-ue5.7": minor
3+
"@epicgames-ps/lib-pixelstreamingsignalling-ue5.7": minor
4+
---
5+
6+
Add: Ability to access player id on the frontend.
7+
QoL: Remove player id stripping from the signalling library.
8+
9+
It is useful to be able to use the player id as a unique identifier that is common between UE side stats and frontend side stats; however, the player id is not actually exposed to TS/JS because the SS strips it out of signalling messages.
10+
11+
This change is a backport of "Exposed playerid" (#728)

Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export class WebRtcPlayerController {
109109
signallingUrlBuilder: () => string;
110110
autoJoinTimer: ReturnType<typeof setTimeout> = undefined;
111111
keepalive: KeepaliveMonitor;
112+
playerId: string | null = null;
112113

113114
/**
114115
*
@@ -1358,6 +1359,11 @@ export class WebRtcPlayerController {
13581359
handleWebRtcAnswer(Answer: Messages.answer) {
13591360
Logger.Info(`Got answer sdp ${Answer.sdp}`);
13601361

1362+
// Extract the player id if it is present
1363+
if (Answer.playerId) {
1364+
this.playerId = Answer.playerId;
1365+
}
1366+
13611367
const sdpAnswer: RTCSessionDescriptionInit = {
13621368
sdp: Answer.sdp,
13631369
type: 'answer'
@@ -1374,6 +1380,11 @@ export class WebRtcPlayerController {
13741380
handleWebRtcOffer(Offer: Messages.offer) {
13751381
Logger.Info(`Got offer sdp ${Offer.sdp}`);
13761382

1383+
// Extract the player id if it is present
1384+
if (Offer.playerId) {
1385+
this.playerId = Offer.playerId;
1386+
}
1387+
13771388
this.isUsingSFU = Offer.sfu ? Offer.sfu : false;
13781389
this.isUsingSVC = Offer.scalabilityMode ? Offer.scalabilityMode != 'L1T1' : false;
13791390
if (this.isUsingSFU || this.isUsingSVC) {

Signalling/src/StreamerConnection.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ export class StreamerConnection extends EventEmitter implements IStreamer, LogUt
136136
} else {
137137
const player = this.server.playerRegistry.get(message.playerId);
138138
if (player) {
139-
delete message.playerId;
140139
LogUtils.logForward(this, player, message);
141140
player.protocol.sendMessage(message);
142141
}

0 commit comments

Comments
 (0)