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

Commit

Permalink
expose emitCommand, remove emitConsoleCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
hmuurine committed Mar 2, 2023
1 parent 513355d commit 70c14a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
13 changes: 8 additions & 5 deletions Frontend/library/src/PixelStreaming/PixelStreaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,18 @@ export class PixelStreaming {
}

/**
* Send a console command to UE application. Only allowed if UE has signaled that it allows
* console commands.
* Send a command to UE application. Blocks ConsoleCommand descriptors unless UE
* has signaled that it allows console commands.
* @returns true if succeeded, false if rejected
*/
public emitConsoleCommand(command: string) {
if (!this.allowConsoleCommands || !this._webRtcController.videoPlayer.isVideoReady()) {
public emitCommand(descriptor: object) {
if (!this._webRtcController.videoPlayer.isVideoReady()) {
return false;
}
if (!this.allowConsoleCommands && 'ConsoleCommand' in descriptor) {
return false;
}
this._webRtcController.emitConsoleCommand(command);
this._webRtcController.emitCommand(descriptor);
return true;
}

Expand Down
10 changes: 4 additions & 6 deletions Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1684,17 +1684,15 @@ export class WebRtcPlayerController {
}

/**
* Send a console command message
* Send a Command message
*/
emitConsoleCommand(command: string) {
emitCommand(descriptor: object) {
Logger.Log(
Logger.GetStackTrace(),
'---- Sending custom Command:ConsoleCommand message ----',
'---- Sending custom Command message ----',
6
);
this.sendDescriptorController.emitCommand({
ConsoleCommand: command,
});
this.sendDescriptorController.emitCommand(descriptor);
}

/**
Expand Down

0 comments on commit 70c14a5

Please sign in to comment.