Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: producer.replaceTrack() doesn't work. #62

Open
un-hongly opened this issue Aug 30, 2022 · 4 comments
Open

Bug Report: producer.replaceTrack() doesn't work. #62

un-hongly opened this issue Aug 30, 2022 · 4 comments

Comments

@un-hongly
Copy link

I'm working on a feature where user can switch their camera. To do that I replace a new track for the producer using producer.replaceTrack(newTrack) but it always returns a log that says "replaceTrack() | same track, ignored." even when I pass a completely new track.

I looked into your code inside producer.dart file at line 357 you compare a track parameter to the track parameter itself (see below) which is why the condition is always matched.

  Future<void> replaceTrack(MediaStreamTrack track) async {
   ...
       if (track == track) {
      _logger.debug('replaceTrack() | same track, ignored.');

      return;
    }
  ...
  }
@Blancduman
Copy link
Owner

LOL. Sorry for that.
Im working on major update. For now, implement it by closing producer and creating new.

@Blancduman
Copy link
Owner

Blancduman commented Oct 11, 2022 via email

@thanhle7
Copy link

Two years since then function "replaceTrack" is yet unable to work.

@thanhle7
Copy link

By looking at producer.dart, I foud something weird :)

// Set the new track.
track = track;

why not using:

this.track = track;

or, rename the class property with '_' prefix, then

_track = track;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants