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

Commit

Permalink
Handle statsPanel or settingsPanel being undefined. (#392)
Browse files Browse the repository at this point in the history
Signed-off-by: timbotimbo <timbotimbo@users.noreply.github.com>
  • Loading branch information
timbotimbo committed Oct 19, 2023
1 parent 81c3f52 commit af5339b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Frontend/ui-library/src/Application/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,15 @@ export class Application {
* Shows or hides the settings panel if clicked
*/
settingsClicked() {
this.statsPanel.hide();
this.statsPanel?.hide();
this.settingsPanel.toggleVisibility();
}

/**
* Shows or hides the stats panel if clicked
*/
statsClicked() {
this.settingsPanel.hide();
this.settingsPanel?.hide();
this.statsPanel.toggleVisibility();
}

Expand Down Expand Up @@ -583,7 +583,7 @@ export class Application {
);
}
// disable starting a latency checks
this.statsPanel.onDisconnect();
this.statsPanel?.onDisconnect();
}

/**
Expand Down Expand Up @@ -630,7 +630,7 @@ export class Application {
if (!this.stream.config.isFlagEnabled(Flags.AutoPlayVideo)) {
this.showPlayOverlay();
}
this.statsPanel.onVideoInitialized(this.stream);
this.statsPanel?.onVideoInitialized(this.stream);
}

/**
Expand All @@ -646,25 +646,25 @@ export class Application {

onInitialSettings(settings: InitialSettings) {
if (settings.PixelStreamingSettings) {
this.statsPanel.configure(settings.PixelStreamingSettings);
this.statsPanel?.configure(settings.PixelStreamingSettings);
}
}

onStatsReceived(aggregatedStats: AggregatedStats) {
// Grab all stats we can off the aggregated stats
this.statsPanel.handleStats(aggregatedStats);
this.statsPanel?.handleStats(aggregatedStats);
}

onLatencyTestResults(latencyTimings: LatencyTestResults) {
this.statsPanel.latencyTest.handleTestResult(latencyTimings);
this.statsPanel?.latencyTest.handleTestResult(latencyTimings);
}

onDataChannelLatencyTestResults(result: DataChannelLatencyTestResult) {
this.statsPanel.dataChannelLatencyTest.handleTestResult(result);
this.statsPanel?.dataChannelLatencyTest.handleTestResult(result);
}

onPlayerCount(playerCount: number) {
this.statsPanel.handlePlayerCount(playerCount);
this.statsPanel?.handlePlayerCount(playerCount);
}

handleStreamerListMessage(messageStreamingList: MessageStreamerList, autoSelectedStreamerId: string | null) {
Expand Down

0 comments on commit af5339b

Please sign in to comment.