jitsi / lib-jitsi-meet

A low-level JS video API that allows adding a completely custom video experience to web apps.
Apache License 2.0
1.32k stars 1.11k forks source link

Stop Desktop sharing, not retrieving Camera back #1363

Open tiofabby opened 3 years ago

tiofabby commented 3 years ago

When user starts the sharing everyone can see the new stream (video desktop) but when same user stops sharing we dont get the new stream back (video camera). This is exact same code handling camera <-> desktop switch.

Environment: Video Bridge, docker images: "stable-4857" lib-jitis-meet version: latest

Workaround, Fix: Downgrade lib-jitsi-meet version to: commit #b8f68b9

Workaround kind of shows that a bug may have been introduced in Q3 2020 in lib-jitsi-meet changes.

Thank you Fabrice

mylmz10 commented 3 years ago

I have a same issue :/

sapkra commented 3 years ago

Maybe it's the same issue like here: https://github.com/jitsi/lib-jitsi-meet/issues/1333

tiofabby commented 3 years ago

Hi, no I dont think it is. I tried indeed but muting or unmuting streams does not resolve such issue. Thanks

jallamsetty1 commented 3 years ago

@tiofabby, will you be able to share browser console logs when this happens so that we can figure out what is happening ?

tiofabby commented 3 years ago

Hi @jallamsetty1 , there is nothing unfortunately in Chrome end user console logs or either in jitsi video bridge images interesting I could found and share, no warning, no error messages happening... If you are able to plug an app using latest lib-jitsi-meet to Video Bridge with a "stable-4857" version, you could experience such same issue and may understand better what is happening. Thank you for looking into such issue as this is preventing us from using the latest version of lib-jitsi-meet.

jallamsetty1 commented 3 years ago

Hi @jallamsetty1 , there is nothing unfortunately in Chrome end user console logs or either in jitsi video bridge images interesting I could found and share, no warning, no error messages happening... If you are able to plug an app using latest lib-jitsi-meet to Video Bridge with a "stable-4857" version, you could experience such same issue and may understand better what is happening. Thank you for looking into such issue as this is preventing us from using the latest version of lib-jitsi-meet.

meet.jit.si uses the latest lib-jitsi-meet and the issue doesn't reproduce there so it could be the way you are replacing the tracks that is exposing this bug. Unfortunately, there is nothing much we can do without logs or a reliable way of reproducing this issue.

mylmz10 commented 3 years ago

Maybe it's the same issue like here: #1333

Thanks @sapkra, I had set sender video constraint, it resolved.

draconid719 commented 3 years ago

Hi @jallamsetty1 I have same issue. I am using lib-jitsi-meet library. When I tried to share screen with JitsiStreamPresenterEffect, it works. But I tried to come back to Camera back, it just stopped. And I found some snippets from jitsi-meet.

async _turnScreenSharingOff(didHaveVideo) {
        this._untoggleScreenSharing = null;
        this.videoSwitchInProgress = true;
        const { receiver } = APP.remoteControl;

        if (receiver) {
            receiver.stop();
        }

        this._stopProxyConnection();
        if (config.enableScreenshotCapture) {
            APP.store.dispatch(toggleScreenshotCaptureEffect(false));
        }

Should I do something with stopProxyConnection()? Here is my console log.

index.js:1472 2020-10-21T17:37:28.919Z [modules/RTC/TraceablePeerConnection.js] <A._assertTrackBelongs>:  removeStream: LocalTrack[3,video] does not belong to TPC[1,p2p:false]
console.<computed> @ index.js:1472
overrideMethod @ react_devtools_backend.js:2273
o @ Logger.js:154
A._assertTrackBelongs @ TraceablePeerConnection.js:1740
A.removeTrack @ TraceablePeerConnection.js:1771
A.replaceTrack @ TraceablePeerConnection.js:1838
n @ JingleSessionPC.js:1914
_processQueueTasks @ AsyncQueue.js:26
process @ async.js:809
(anonymous) @ async.js:806
(anonymous) @ async.js:32
(anonymous) @ JingleSessionPC.js:1940
Promise.then (async)
n @ JingleSessionPC.js:1940
_processQueueTasks @ AsyncQueue.js:26
process @ async.js:809
(anonymous) @ setImmediate.js:40
m @ setImmediate.js:69
a @ setImmediate.js:109
postMessage (async)
i @ setImmediate.js:120
h.setImmediate @ setImmediate.js:27
n.nextTick.a.setImmediate @ async.js:110
(anonymous) @ async.js:768
l @ async.js:46
n @ async.js:753
push @ async.js:782
push @ AsyncQueue.js:52
(anonymous) @ JingleSessionPC.js:1944
replaceTrack @ JingleSessionPC.js:1943
ie._doReplaceTrack @ JitsiConference.js:1106
ie.replaceTrack @ JitsiConference.js:1074
ie.removeTrack @ JitsiConference.js:1046
dispose @ JitsiLocalTrack.js:683
_callee$ @ main.chunk.js:28758
tryCatch @ runtime.js:64
invoke @ runtime.js:281
(anonymous) @ runtime.js:117
asyncGeneratorStep @ asyncToGenerator.js:3
_next @ asyncToGenerator.js:25
(anonymous) @ asyncToGenerator.js:32
(anonymous) @ asyncToGenerator.js:21
(anonymous) @ main.chunk.js:28785
Promise.then (async)
createLocalVideoTrack @ main.chunk.js:28728
switchVideo @ main.chunk.js:28715
(anonymous) @ DropdownItem.js:40
(anonymous) @ useEventCallback.js:6
handleClick @ SafeAnchor.js:39
callCallback @ react-dom.development.js:189
invokeGuardedCallbackDev @ react-dom.development.js:238
invokeGuardedCallback @ react-dom.development.js:291
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:306
executeDispatch @ react-dom.development.js:391
executeDispatchesInOrder @ react-dom.development.js:416
executeDispatchesAndRelease @ react-dom.development.js:3301
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:3310
forEachAccumulated @ react-dom.development.js:3282
runEventsInBatch @ react-dom.development.js:3327
runExtractedPluginEventsInBatch @ react-dom.development.js:3537
handleTopLevel @ react-dom.development.js:3581
batchedEventUpdates$1 @ react-dom.development.js:21729
batchedEventUpdates @ react-dom.development.js:798
dispatchEventForLegacyPluginEventSystem @ react-dom.development.js:3591
attemptToDispatchEvent @ react-dom.development.js:4311
dispatchEvent @ react-dom.development.js:4232
unstable_runWithPriority @ scheduler.development.js:659
runWithPriority$1 @ react-dom.development.js:11077
discreteUpdates$1 @ react-dom.development.js:21746
discreteUpdates @ react-dom.development.js:811
dispatchDiscreteEvent @ react-dom.development.js:4211
GreatTA1998 commented 3 years ago

When user starts the sharing everyone can see the new stream (video desktop) but when same user stops sharing we dont get the new stream back (video camera). This is exact same code handling camera <-> desktop switch.

Environment: Video Bridge, docker images: "stable-4857" lib-jitis-meet version: latest

Workaround, Fix: Downgrade lib-jitsi-meet version to: commit #b8f68b9

Workaround kind of shows that a bug may have been introduced in Q3 2020 in lib-jitsi-meet changes.

Thank you Fabrice

I just want to say thank you so much for filing this report, because it led me to discover that I need to add "setVideoConstraint". This will save me around $1000/month running a website for university, and I've been unable to switch to Jitsi because of this error. You're a life saver.

ykatyhoney commented 3 years ago

I seemed to find the solution. I should set videoConstraint and also set setEffect(undefined) before dispose the track.

GreatTA1998 commented 3 years ago

I seemed to find the solution. I should set videoConstraint and also set setEffect(undefined) before dispose the track.

I am running into an issue with .dispose() throwing a "RTCRtpTransceiver for video not found" for iOS safari. Doing "setEffect(undefined)" helped resolve the bug, so thank you very much.

There is one additional problem, which is the TRACK_REMOVED is not getting triggered for other participants for some reason still. @ykatyhoney do you have some example code of it working? I'm trying to create a minimal code that enables audio, video and screenshare for Safari and Chrome and my current progress is here: https://github.com/eltonlin1998/jitsi-vue-experiment

tiofabby commented 3 years ago

I seemed to find the solution. I should set videoConstraint and also set setEffect(undefined) before dispose the track.

It makes the trick indeed, adding setEffect(undefined) makes it work back even with very last version of lib-jitsi-meet Thanks for work around @ykatyhoney

Example:

     createLocalTracks(
      { devices: [isVideo ? 'video' : 'desktop' ], constraints: bwConstraints}).then(tracks => {
        // Workaround
        tracks[0].setEffect(undefined)
        ...
GreatTA1998 commented 3 years ago

I seemed to find the solution. I should set videoConstraint and also set setEffect(undefined) before dispose the track.

It makes the trick indeed, adding setEffect(undefined) makes it work back even with very last version of lib-jitsi-meet Thanks for work around @ykatyhoney

Example:

     createLocalTracks(
      { devices: [isVideo ? 'video' : 'desktop' ], constraints: bwConstraints}).then(tracks => {
        // Workaround
        tracks[0].setEffect(undefined)
        ...

Hi Tiofabby, was hoping to ask: how do you manage to use the latest version of lib-jitsi-meet, is it npm install or do you copy the .min.js file from some repository?

tiofabby commented 3 years ago

Hi @eltonlin1998 To use last version of lib-jitsi-meet, I have in my package.json:

1/ dependencies / "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#6bb0b86",

2/ scripts / "install_full": "npm install lib-jitsi-meet --ignore-scripts && cd node_modules/lib-jitsi-meet/ && npm install && npm run postinstall && cd ../.. && npm install", and need to run such 'install full' with a npm run install_full

draconid719 commented 3 years ago

I also tried to use jitsi meet library as dependency but 3 months later, when I tried to run the project, it gave me some troubles, so now I am using min version directly by adding Githubissues.

  • Githubissues is a development platform for aggregating issues.