janus.js onmute event causes videos to disappear and not reappear in mvideoroom

1,365 views
Skip to first unread message

quinn.m...@phdmedical.com

unread,
Apr 19, 2019, 2:11:49 PM4/19/19
to meetecho-janus
Hi Lorenzo, 

Reporting another situation I noticed in the mvideoroom demo.

This concerns the onmute and onunmute events in janus.js. I noticed that you assigned the onmute event to perform the onended function.
event.track.onmute = event.track.onended;
 
I noticed it pretty much runs the pluginHandle.onremotetrack function, which is also run in event.track.onunmute and you differentiate whether it's being added or removed through a function parameter.

Anyways, once an onmute event is passed through, the video changes to "No remote video available", and then when the video begins flowing again, it doesn't reappear as it should and instead continues to display "No remote video available".

I noticed in janus.js, you are putting this code (pluginHandle.onremotetrack) in a try-catch block, but don't do anything within the catch block. I added a console message in this catch block and I get this error:

TypeError: Cannot set property 'srcObject' of undefined
    at Function.Janus.attachMediaStream (janus.js:299)
    at Object.onremotetrack (mvideoroomtest.js:782)
    at MediaStreamTrack.event.track.onunmute (janus.js:1745)

Upon further inspection I find this is because when we try to add the video back in the onunmute event, the slot variable within the onremotetrack function is undefined since we just deleted the slot (delete slots[mid]) for that mid when we ran the onremotetrack function due to the onmute event. Therefore, there is no video element available to attach the stream to. As a result, the interface simply continues displaying "No remote video available".

I did a simple test, and commented out the handling of the event.track.onmute and event.track.onunmute, and the video then just pauses when Janus loses video for an amount of time and then resumes. I am able to reproduce this event (onmute) by simply disconnecting and reconnecting to my wi-fi quickly.

I am just letting you know that perhaps the logic in onremotetrack in myvideoroomtest.js needs to be modified slightly to account for this situation.

Regards,
Quinn

lmin...@gmail.com

unread,
Apr 23, 2019, 4:40:10 AM4/23/19
to meetecho-janus
Thanks, I'll add a logline in the catch to track issues, including this.

Lorenzo 

Lorenzo Miniero

unread,
May 15, 2019, 8:16:23 AM5/15/19
to meetecho-janus
FYI, after a huge delay I managed to start looking into this, and there are a couple of new commits that should improve things. Next step will be investigating the slots[mid] thing, which I managed to replicate easily by issuing a "configure" request for a publisher to drop and then resume video (so no need to tweak the network as you did).

Lorenzo

Lorenzo Miniero

unread,
May 15, 2019, 11:28:50 AM5/15/19
to meetecho-janus
Hi Quinn,

the issue you reported at the time should be fixed now. Please let me know if that's not the case.

Lorenzo

Jaffer Kazmi

unread,
May 11, 2020, 7:49:45 AM5/11/20
to meetecho-janus
Hey there i am also facing the same issue, i have integrated janus video room plugin with my react app and remote video goes blank whenever a little network drop occur, i have seen mute and unmute events triggered that remove and reattach the video which seems a very bad experience, I just wanted ask is there any solution so that video never goes blank ??

Serhat Sakarya

unread,
May 11, 2020, 7:56:02 AM5/11/20
to Jaffer Kazmi, meetecho-janus
I've noticed that too, it can be quite distracting. I would rather have a short freeze that most people won't notice.

What I did to mitigate this was to check if there is already a video element and a stream with video tracks. If so, I just ignore the event. Then it seems to resolve itself. I get this a lot too when sharing a screen that has little activity.

I'm not sure if this approach is the proper one, but it solves the problem for me. Good luck!

Regards,

Serhat

--
You received this message because you are subscribed to the Google Groups "meetecho-janus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meetecho-janus/8d1ccfc1-82d1-4135-a68c-9d078fa9a1c0%40googlegroups.com.

Jaffer Kazmi

unread,
May 11, 2020, 8:07:38 AM5/11/20
to meetecho-janus
Thanks Serhat , i have also done this but by removing the event calling and works for me temporarily but i am looking for a permanent solution to this. By the way Thanks again for reply
To unsubscribe from this group and stop receiving emails from it, send an email to meetech...@googlegroups.com.

Lorenzo Miniero

unread,
May 11, 2020, 10:51:52 AM5/11/20
to meetecho-janus
For the love of god, do you guys even do a search before posting stuff? I guess not.

L.

Alessandro Amirante

unread,
May 11, 2020, 2:28:19 PM5/11/20
to Lorenzo Miniero, meetecho-janus
Anyway this thread was originally intended to report a different issue, i.e., video disappearing and never re-appearing with the old multistream branch and the related mvideotoomtest demo. This will be addressed as soon as we start working on the a new PR adding support for multistream in Janus, which will happen soon thanks to a company who decided to sponsor this development!

A.

To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meetecho-janus/ea9220fe-f1c5-4d13-bbad-301ea45553bf%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages