Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions examples/typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}

Expand Down