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