remote video not showing in e2e encrypted videoroom

345 views
Skip to first unread message

Abhishek Rhisheekesan

unread,
Mar 13, 2021, 9:49:21 AM3/13/21
to meetecho-janus
I tried adding e2e encryption to videoroom based on janus that we are using. we updated janus to latest ver 0.11.1. senderTransforms and receiverTransforms code was added based on e2etest.js code. But the remote video is not seen. Local video can be seen. If I remove this e2e encryption support, remote video is seen.

To debug further, instead of using the xor based encryption, I tried passing the data as is in senderTransforms and receiverTransforms, but still remote video cannot be seen. I tried with and without require_e2ee setting for the videoroom, but remote video is still not visible.

any suggestions to debug?

Let me know if I need to share the code that I added for e2e encryption.

Abhishek Rhisheekesan

unread,
Mar 13, 2021, 12:33:46 PM3/13/21
to meetecho-janus
End-to-end encryption demo page on the Janus webrtc server I am using is working fine. So seems like some issue / compatibility with the videoroom/janus frontend code being used.

Abhishek Rhisheekesan

unread,
Mar 17, 2021, 9:59:05 AM3/17/21
to meetecho-janus
Please let us know if sharing the code we have used or some debug information or anything else can help to get a response on this. We are kind of stuck here.

Abhishek Rhisheekesan

unread,
Mar 30, 2021, 11:16:00 AM3/30/21
to meetecho-janus
Please let us know if why this might be not working. Or if someone has recently tried e2e encryption support from Janus in their code, can you please share steps/instructions on how to use it? We are not quite sure how to proceed with the debug here.

virendra singh

unread,
Mar 30, 2021, 11:32:06 AM3/30/21
to Abhishek Rhisheekesan, meetecho-janus
Hi Abhishek, 

There is one more way to do that e2e in videoroom.




--
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/14979acb-08ca-4be7-a536-6cb354322aa5n%40googlegroups.com.


--
VIRENDRA SINGH
Software Engineer

Abhishek Rhisheekesan

unread,
Mar 30, 2021, 11:45:03 AM3/30/21
to meetecho-janus
Are you saying to attach to createOffer and createAnswer events and do the encryption there?

Or is the suggestion to use event handlers for debugging senderTransforms and receiverTransforms?

Back to the debug of senderTransforms and receiverTransforms, the part that is baffling me is even when we pass through the data as is in senderTransforms and receiverTransforms, the remote video is still not visible. Although in the e2etest.js end-to-end encryption demo that comes with the same Janus backend server code we are using, senderTransforms and receiverTransforms work fine. Is there a way to debug the incoming and outgoing contents of senderTransforms and how that data is treated by createOffer and createAnswer and the Janus backend videoroom plugin code? Since janus.js is using pipeThrough and pipeTo and all, as shown below, we are not sure how to track the different functions being called to process senderTransforms and receiverTransforms in that pipeline. Any ideas on how to proceed with this debug?

                    if(senderStreams) {
                        console.log(senderStreams);
                        if(senderStreams.readableStream && senderStreams.writableStream) {
                            senderStreams.readableStream
                                .pipeThrough(config.senderTransforms[sender.track.kind])
                                .pipeTo(senderStreams.writableStream);
                        } else if(senderStreams.readable && senderStreams.writable) {
                            senderStreams.readable
                                .pipeThrough(config.senderTransforms[sender.track.kind])
                                .pipeTo(senderStreams.writable);
                        }
                    }

                    if(receiverStreams) {
                        console.log(receiverStreams);
                        if(receiverStreams.readableStream && receiverStreams.writableStream) {
                            receiverStreams.readableStream
                                .pipeThrough(config.receiverTransforms[event.track.kind])
                                .pipeTo(receiverStreams.writableStream);
                        } else if(receiverStreams.readable && receiverStreams.writable) {
                            receiverStreams.readable
                                .pipeThrough(config.receiverTransforms[event.track.kind])
                                .pipeTo(receiverStreams.writable);
                        }
                    }

virendra singh

unread,
Mar 30, 2021, 11:52:13 AM3/30/21
to Abhishek Rhisheekesan, meetecho-janus
Yes, you need to follow this article once, There is nothing published even the demo code too for E2EE video room.I did not get any help related to do this, but if you will get better than this, then let me know. 

Abhishek Rhisheekesan

unread,
Mar 30, 2021, 11:58:46 AM3/30/21
to meetecho-janus
Do you have any sample code that you can share for e2e encryption using event handlers? If so, can you please email to abhish...@gmail.com?

Sure, I am going through that link you provided to understand how to attach the event handlers to createOffer and createAnswer.

Abhishek Rhisheekesan

unread,
Mar 30, 2021, 12:05:34 PM3/30/21
to meetecho-janus
not sure if the email went through google groups policing - here it is (remove those spaces) - abhishekr1982 @ gmail.com

Lorenzo Miniero

unread,
Mar 31, 2021, 2:44:58 AM3/31/21
to meetecho-janus
Event handlers have nothing to do with E2EE. The blog post to refer to is another one: https://www.meetecho.com/blog/janus-e2ee-sframe/

L.

Abhishek Rhisheekesan

unread,
Mar 31, 2021, 11:43:20 AM3/31/21
to meetecho-janus
Hi Lorenzo,
I am referring to the same blog - https://www.meetecho.com/blog/janus-e2ee-sframe/. And I based the code on e2etest.js from https://github.com/meetecho/janus-gateway/blob/master/html/e2etest.js

Here is the code snippet I am using - https://pastebin.com/yWFpBt6z
This has senderTransforms and receiverTransforms for audio and video implemented with xor based encryption and crypto key is a static value for every senderTransforms and receiverTransforms call, to verify if it is working.

I have created the room with require_e2ee set to true in the create request. I tried it with and without this.

Here is the code where senderTransforms and receiverTransforms pass through the data received as is. This is for debug purposes to see if xor encryption was somehow meddling with the data. But even this didnt help - remote video was still not visible.

During debug, the jsep contains e2ee flag set to true. Also senderTransforms and receiverTransforms transform functions are getting called.

Janus backend version used is 0.11.1. janus.js we are using is quite similar to https://github.com/meetecho/janus-gateway/blob/master/html/janus.js, except for some additional functionality that is not related to e2e encryption. To verify if janus backend was working, we tried the demo e2etest.html in html folder and it works fine and remote video is visible.

If we comment out the e2e encryption code mentioned in https://pastebin.com/yWFpBt6z like senderTransforms, receiverTransforms, and their mentions in createOffer and createAnswer, it works fine and remote video is visible.

Mirko Brankovic

unread,
Apr 9, 2021, 11:25:58 AM4/9/21
to meetecho-janus
Sorry i have no experience with this feature yet ;/

On Fri, Apr 9, 2021, 16:38 Abhishek Rhisheekesan <abhish...@gmail.com> wrote:
Hi Mirko,
Please let me know if there are any suggestions to debug this.

On Wed, Mar 31, 2021 at 9:20 PM Abhishek Rhisheekesan <abhish...@gmail.com> wrote:
Hi Mirko,
Yes, we have implemented the code after going through that blog https://www.meetecho.com/blog/janus-e2ee-sframe/ and the code is based on e2etest.js from https://github.com/meetecho/janus-gateway/blob/master/html/e2etest.js

Here is the code snippet I am using - https://pastebin.com/yWFpBt6z
This has senderTransforms and receiverTransforms for audio and video implemented with xor based encryption and crypto key is a static value for every senderTransforms and receiverTransforms call, to verify if it is working.

I have created the room with require_e2ee set to true in the create request. I tried it with and without this.

Here is the code where senderTransforms and receiverTransforms pass through the data received as is. This is for debug purposes to see if xor encryption was somehow meddling with the data. But even this didnt help - remote video was still not visible.

During debug, the jsep contains e2ee flag set to true. Also senderTransforms and receiverTransforms transform functions are getting called.

Janus backend version used is 0.11.1. janus.js we are using is quite similar to https://github.com/meetecho/janus-gateway/blob/master/html/janus.js, except for some additional functionality that is not related to e2e encryption. To verify if janus backend was working, we tried the demo e2etest.html in html folder and it works fine and remote video is visible.

If we comment out the e2e encryption code mentioned in https://pastebin.com/yWFpBt6z like senderTransforms, receiverTransforms, and their mentions in createOffer and createAnswer, it works fine and remote video is visible.

Can you please explain what is this code in janus.js doing? Does it help if we track the video/audio stream chunks being passed through these functions and senderStreams/receciverStreams and createEncodedStreams and all?


On Wed, Mar 31, 2021 at 2:34 PM Mirko Brankovic <mirkobr...@gmail.com> wrote:
Have you checked what Lorenzo did in his example?
Both frontend and backend

--
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/14979acb-08ca-4be7-a536-6cb354322aa5n%40googlegroups.com.


--
Regards,
Abhishek


--
Regards,
Abhishek

Chokeanan Wechaprukpitak

unread,
Jan 10, 2023, 1:19:03 AM1/10/23
to meetecho-janus
Hi Abish,
Just wondering if you're able to figure out how to make e2ee work on the videoroom plugin? I'm having the exact same problem you were describing.
Best regards,
Chokeanan

Message has been deleted
Message has been deleted

Sarbajit Bhattacharjee

unread,
Feb 20, 2023, 1:13:13 PM2/20/23
to meetecho-janus
I'm also facing same. 
What should be the createAnswer parameters for transforms in receiverHandle. I'm using videoRoom plugin. 
If i use 
tracks: [
            { type: 'audio', transforms: { receiver: receiverTransforms['audio'] } },
            { type: 'video', transforms: { receiver: receiverTransforms['video'] } },
            { type: 'data' }
],
then remote feeds are black. if i remove audio and video tracks, then encrypted scrambled feed is showing.

Please help

Sarbajit Bhattacharjee

unread,
Feb 22, 2023, 1:23:15 AM2/22/23
to meetecho-janus
Approach might be wrong but solved the issue.

Need correction at this line in janus.js

in line 2586, update the condition.

else if(track.recv && !transceiver)
to 
else if(track.recv) {
                if (!transceiver) {
                    // Maybe a new recvonly track
                    transceiver = config.pc.addTransceiver(kind);
                }
                .....
}

After changing this, remote videos are showing.

Sarbajit Bhattacharjee

unread,
Feb 22, 2023, 1:30:28 AM2/22/23
to meetecho-janus
For publisher offer,

const tracks = [
  { type: 'audio', capture: true, recv: false, transforms: { sender: senderTransforms['audio'] } },
  { type: 'video', capture: true, recv: false, simulcast: false, transforms: { sender: senderTransforms['video'] } },
  { type: 'data' }
];

For subscriber answer,

const tracks = [
          { type: 'audio', capture: false, recv: true, transforms: { receiver: receiverTransforms['audio'] } },
          { type: 'video', capture: false, recv: true, transforms: { receiver: receiverTransforms['video'] } },
          { type: 'data' }
        ];

Reply all
Reply to author
Forward
0 new messages