From a3f30cb89c58a58680aff6a1da995361d4b23373 Mon Sep 17 00:00:00 2001 From: David MacPherson Date: Tue, 16 May 2023 21:09:30 +1000 Subject: [PATCH 1/2] Replaced the logic to send the offer from the frontend depending on what is sent from the signalling server --- examples/typescript/src/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/typescript/src/index.ts b/examples/typescript/src/index.ts index 90128ce4..abdbad55 100644 --- a/examples/typescript/src/index.ts +++ b/examples/typescript/src/index.ts @@ -11,6 +11,8 @@ declare var WEBSOCKET_URL: string; class MessageExtendedConfig extends MessageRecv { peerConnectionOptions: RTCConfiguration; engineVersion: string + platform: string + frontendToSendOffer: boolean }; // Extend PixelStreaming to use our custom extended config that includes the engine version @@ -35,10 +37,9 @@ document.body.onload = function () { // Create stream and spsApplication instances that implement the Epic Games Pixel Streaming Frontend PixelStreaming and Application types const stream = new ScalablePixelStreaming(config); - // Override the onConfig so we can determine if we need to send the WebRTC offer based on the engine version - // If the engine version is 4.27 or not defined, the browser should send the offer. This is what the Scalable Pixel Streaming signalling server will be expecting. + // Override the onConfig so we can determine if we need to send the WebRTC offer based on what is sent from the signalling server stream.webSocketController.onConfig = (messageExtendedConfig: MessageExtendedConfig) => { - stream.config.setFlagEnabled(Flags.BrowserSendOffer, (messageExtendedConfig.engineVersion == "4.27" || messageExtendedConfig.engineVersion == "")); + stream.config.setFlagEnabled(Flags.BrowserSendOffer, messageExtendedConfig.frontendToSendOffer); stream.handleOnConfig(messageExtendedConfig); } From 6f96953e0b566b36c77e1de11385ef4026b714b7 Mon Sep 17 00:00:00 2001 From: David MacPherson Date: Thu, 18 May 2023 13:55:35 +1000 Subject: [PATCH 2/2] Added missed semicolons --- examples/typescript/src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/typescript/src/index.ts b/examples/typescript/src/index.ts index abdbad55..5d77535c 100644 --- a/examples/typescript/src/index.ts +++ b/examples/typescript/src/index.ts @@ -10,16 +10,16 @@ declare var WEBSOCKET_URL: string; // Extend the MessageRecv to allow the engine version to exist as part of our config message from the signalling server class MessageExtendedConfig extends MessageRecv { peerConnectionOptions: RTCConfiguration; - engineVersion: string - platform: string - frontendToSendOffer: boolean + engineVersion: string; + platform: string; + frontendToSendOffer: boolean; }; // Extend PixelStreaming to use our custom extended config that includes the engine version class ScalablePixelStreaming extends PixelStreaming { // Create a new method that retains original functionality public handleOnConfig(messageExtendedConfig: MessageExtendedConfig) { - this._webRtcController.handleOnConfigMessage(messageExtendedConfig) + this._webRtcController.handleOnConfigMessage(messageExtendedConfig); } }; @@ -31,7 +31,7 @@ document.body.onload = function () { // make usage of WEBSOCKET_URL if it is not empty let webSocketAddress = WEBSOCKET_URL; if (webSocketAddress != "") { - config.setTextSetting(TextParameters.SignallingServerUrl, webSocketAddress) + config.setTextSetting(TextParameters.SignallingServerUrl, webSocketAddress); } // Create stream and spsApplication instances that implement the Epic Games Pixel Streaming Frontend PixelStreaming and Application types