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

The stream is not restored when the shared window page is minimized and then zoomed in on the NW.js #1179

Open
zesun96 opened this issue Jul 5, 2024 · 11 comments

Comments

@zesun96
Copy link
Contributor

zesun96 commented Jul 5, 2024

Describe the bug

expect: the stream track unmute and re-publish;

Reproduction

A share a window page;
B view it good;
then the window of A is minimized;
B look black picture;
then the window of A is zoomed in;

Logs

I add some logs at client-sdk-js:

  private handleTrackMuteEvent = () =>
    this.debouncedTrackMuteHandler().catch(() =>
      this.log.debug('track mute bounce got cancelled by an unmute event', this.logContext),
    );

  private debouncedTrackMuteHandler = debounce(async () => {
    this.log.debug('track mute event', this.logContext),
    await this.pauseUpstream();
  }, 5000);

  private handleTrackUnmuteEvent = async () => {
    this.log.debug('track unmute event', this.logContext),
    this.debouncedTrackMuteHandler.cancel('unmute');
    await this.resumeUpstream();
  };


but only recived "track mute event" on window  is minimized;

System Info

OS: Windows 10
NWjs version: 0.82.0
livekit client-sdk-js version: v1.15.13

Severity

annoyance

Additional Information

No response

@zesun96
Copy link
Contributor Author

zesun96 commented Jul 5, 2024

I found that the following code was affected track unmute event:
room/track/LovalTrack.ts

async pauseUpstream() {
    const unlock = await this.pauseUpstreamLock.lock();
    try {
      ...
      **await this.sender.replaceTrack(null);**
    } finally {
      unlock();
    }
  }

When I skip this code and run it again, it's fine.

@lukasIO
Copy link
Contributor

lukasIO commented Jul 5, 2024

Can you confirm that you don't receive a unmute event when maximising the window again?

Which browser are you on? Does the same behaviour reproduce with other browsers?

@zesun96
Copy link
Contributor Author

zesun96 commented Jul 5, 2024

I didn't receive unmute event.
It is ok on google browser.

@zesun96
Copy link
Contributor Author

zesun96 commented Jul 5, 2024

image

this is google logs when share window is minimized.
google version: 126.0.6478.127

@zesun96
Copy link
Contributor Author

zesun96 commented Jul 5, 2024

When I commented out the following code in nwjs:
await this.sender.replaceTrack(null);
I can receive unmute event.

@lukasIO
Copy link
Contributor

lukasIO commented Jul 5, 2024

are you able to reproduce this in the sample app using pnpm sample in this repo?

@zesun96
Copy link
Contributor Author

zesun96 commented Jul 5, 2024

no, adaptation is required to used sample in nwjs env.

@lukasIO
Copy link
Contributor

lukasIO commented Jul 5, 2024

I see. I'm not very familiar with NW.js, but then probably this should be reported to NW.js as a bug as it seems to be not emitting the unmute event on the track when a window is restored.

@zesun96
Copy link
Contributor Author

zesun96 commented Jul 5, 2024

I only use nwjs run webrtc sample, the unmute event is emitted.

@aimin-git
Copy link

I see. I'm not very familiar with NW.js, but then probably this should be reported to NW.js as a bug as it seems to be not emitting the unmute event on the track when a window is restored.
@lukasIO I thought the unmute event is emitted by webrtc, isn't it?

@lukasIO
Copy link
Contributor

lukasIO commented Jul 8, 2024

I'm guessing NW.js needs to wrap get display media APIs, similar to how electron has to. That could potentially explain why it works as expected in Chrome, but doesn't in NW.js.

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