client-sdk-js
client-sdk-js copied to clipboard
The stream is not restored when the shared window page is minimized and then zoomed in on the NW.js
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
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.
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?
I didn't receive unmute event. It is ok on google browser.
this is google logs when share window is minimized. google version: 126.0.6478.127
When I commented out the following code in nwjs:
await this.sender.replaceTrack(null);
I can receive unmute event.
are you able to reproduce this in the sample app using pnpm sample in this repo?
no, adaptation is required to used sample in nwjs env.
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.
I only use nwjs run webrtc sample, the unmute event is emitted.
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
unmuteevent on the track when a window is restored. @lukasIO I thought the unmute event is emitted by webrtc, isn't it?
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.