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

[BUG] - streamerIDOption.selected returns an array. Not a string #489

Closed
vinkovsky opened this issue Feb 16, 2024 · 1 comment
Closed

[BUG] - streamerIDOption.selected returns an array. Not a string #489

vinkovsky opened this issue Feb 16, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@vinkovsky
Copy link

vinkovsky commented Feb 16, 2024

UE Version:
UE 5.4

Frontend Version:
UE5.4-0.0.3

Problem component
Frontend

Description
I want to continue the topic raised here
Tested the ability to connect several streamers to one signal server, without using a matchmaker. An array of available streamers comes to the client via a web socket, and everything is cool here.
image

The problem appears when selecting a streamer during initial setup.

    initialSettings: {
           StreamerId: 'DefaultStreamer1'
     }

The StreamerId parameter is not accepted in the PixelStreaming class and no connection to the streamer occurs.
image

This only works if you specify the /?StreamerId=DefaultStreamer1 parameter via the URL
image

Updating In SettingOption.ts in the constructor

    super(id, label, description, [defaultTextValue], defaultOnChangeListener);

to

    super(id, label, description, defaultTextValue, defaultOnChangeListener);

fixed this issue (Thanks @mcottontensor)

Steps to Reproduce:

  1. Clone React example and pass StreamerId: 'DefaultStreamer1' (or your streamer's name) option to Config
  2. Run two streamers on the same 8888 ports
  3. Start the signalling web server and configure it to listen two streamers on the 8888. Only one signaling server required!
  4. Try connecting to the stream from the client (You won`t succeed)
  5. At this point go to WebRtcPlayerController.ts -> handleStreamerListMessage method and try to log streamerIDOption.selected.

As mentioned in SettingsOption.ts selected() getter must return a string. But here it is an array of strings. Typescript won't tell you the error, you have to check the console. Because of this, the condition does not work correctly and the wanted streamer is not assigned to a variable

Here is a piece of code from WebRtcPlayerController.handleStreamerListMessage()

      //Oh, why is there var here???
      var streamerIDOption = this.config.getSettingOption(OptionParameters.StreamerId); // <--  Here is an array !!
      const existingSelection = streamerIDOption.selected.toString().trim(); // <-- Here is a string. Its ok
      if (!!existingSelection) { // <-- Cool, we're inside an if statement
            // default to selected option if it exists
            wantedStreamerId = streamerIDOption.selected; // <-- OMG. Here is an array !!
      }
      
      .... 
      
      ....
                                                         // (sh*t, here is an array) conditions go wrong
      if (wantedStreamerId && messageStreamerList.ids.includes(wantedStreamerId)) {
            // if the wanted stream is in the list. we pick that <-- (will be cool, but ['Streamer', 'Streamer1'].includes(['Streamer']) returns false)
            autoSelectedStreamerId = wantedStreamerId;

This also doesn't work correctly if there is only one streamer but with a specified StreamerId on the client.

Expected behavior

  1. The stream must run through the selected StreamerID.

Platform (please complete the following information):

  • OS: Ubuntu Desktop 22.04.3 LTS
  • Chrome Version 121.0.6167.160 (Official Build) (64-bit)

P.S. Many thanks for your hard work. You've created a really great library.

@vinkovsky vinkovsky added the bug Something isn't working label Feb 16, 2024
@vinkovsky vinkovsky changed the title streamerIDOption.selected returns an array. Not a string [BUG] - streamerIDOption.selected returns an array. Not a string Feb 16, 2024
@mcottontensor mcottontensor self-assigned this Feb 18, 2024
@mcottontensor mcottontensor mentioned this issue Feb 20, 2024
6 tasks
@mcottontensor
Copy link
Contributor

Added to master, will be in 5.4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants