Interacting With the Pixel Streaming System in Unreal Engine | Unreal Engine 5.5 Documentation | Epic Developer Community
In this Docs, " Register your listener function by calling the addResponseEventListener
function provided by app.js
." I use Unreal 5.5, I use PixelStreamingInfrastructure EpicGamesExt/PixelStreamingInfrastructure: The official Pixel Streaming servers and frontend. but i can’t find app.js. help plz
Hey @Mr.Forger,
It seems that the UE docs are slightly out of date. Try using the docs provided by the PixelStreamingInfrastructure repo: PixelStreamingInfrastructure/Frontend/Docs/Communicating from UE5 to the Player Page.md at master · EpicGamesExt/PixelStreamingInfrastructure · GitHub
If you’re using the reference typescript implementation, you would modify Frontend/implementations/typescript/src/player.ts
just after line 23.
function myHandleResponseFunction(data) {
console.warn("Response received!");
switch (data) {
case "MyCustomEvent":
... // handle one type of event
case "AnotherEvent":
... // handle another event
}
}
document.body.onload = function() {
Logger.InitLogging(LogLevel.Warning, true);
// Create a config object
const config = new Config({ useUrlParams: true });
// Create the main Pixel Streaming object for interfacing with the web-API of Pixel Streaming
const stream = new PixelStreaming(config);
stream.addResponseEventListener("handle_responses", myHandleResponseFunction);
const application = new Application({
stream,
onColorModeChanged: (isLightMode) => PixelStreamingApplicationStyles.setColorMode(isLightMode)
});
document.body.appendChild(application.rootElement);
window.pixelStreaming = stream;
}