Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Api support for UE communication #132

Merged
merged 10 commits into from
Mar 6, 2023

Conversation

hmuurine
Copy link
Collaborator

@hmuurine hmuurine commented Mar 1, 2023

Summary

Adds support for browser <-> UE communication through the API:

  • emitUIInteraction(data: object | string):
    • sends arbitrary data as an UIInteraction message
  • emitCommand(descriptor: object):
    • sends a Command message
    • if the descriptor contains a ConsoleCommand, it is permitted only if the UE app has been started with-AllowPixelStreamingCommands command line argument
  • emitConsoleCommand(command: string):
    • sends a ConsoleCommand message
    • permitted only if the UE app has been started with -AllowPixelStreamingCommands command line argument
  • addResponseEventListener(name, funct) / removeResponseEventListener(name):
    • register/remove a listener that is triggered when receiving UE -> browser messages

Test plan

Browser <-> UE

  • Modified UE Pixel Streaming application to do the following:
    • Monitors for any incoming browser -> UE messages that contain the string EchoBack
    • If one received, send back a response with content EchoResponse: $originalMessage
      blueprint
  • Modified uiless.ts to do the following:
    • Sends a UIInteraction message starting with EchoBack 10 seconds after page has been opened
    • Logs any responses received from UE
      Screenshot 2023-03-01 at 13 55 30
  • Started uiless.html and waited for 10 seconds
  • Verified that the browser -> UE and UE -> browser messages were both logged, ensuring that communication works both ways
    Screenshot 2023-03-01 at 13 42 55

Custom commands

  • Started a Pixel Streaming UE app with command line parameter -AllowPixelStreamingCommands
  • Added some code to uiless.ts to toggle FPS counter and degrade video quality 10 seconds after initialization:
setTimeout(() => {
	pixelStreaming.emitCommand({
		ConsoleCommand: "stat fps",
	});
	pixelStreaming.emitCommand({
		"Encoder.MinQP": 51,
	});
}, 10000);
  • Opened uiless.html, waited for 10 seconds, and verified that FPS counter was enabled and video quality was degraded
    Screenshot 2023-02-28 at 9 28 26
    Screenshot 2023-03-02 at 9 05 52

  • Repeated the test with -AllowPixelStreamingCommands command line arg disabled

  • Verified that FPS counter was not enabled after 10 seconds, since the console command was rejected. Video was still degraded as expected

@hmuurine hmuurine force-pushed the api-support-for-ue-communication branch from 1e99767 to 70c14a5 Compare March 2, 2023 07:10
Copy link
Contributor

@lukehb lukehb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@lukehb lukehb merged commit 9de61bf into EpicGames:master Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants