E2E encryption with SFrames not working

I’ve been unable to implement e2ee with sframes onto my video calls. I’ve been following this blog post Having fun with Insertable Streams and E2EE (and SFrame!) | Meetecho Blog and using the sframe module (imported locally) but can’t seem to get it to work. Is the code used to create that e2ee echotest available somewhere to reference? I wasn’t able to find it on the github page.

The general flow I was using was
getUserMedia which gives video stream stream, then
const sender = localVideoPeerConnection.addTrack(stream.getTracks()[0], stream);
const client = await SFrame.createClient(0, {});
await client.setSenderEncryptionKey(this.stringToUint8Array(‘1234’)); // key that user inputs, hardcoded for now
client.encrypt(sender.track.id, sender);

I then create the offer and do setLocalDescription on the pc

This seems to have no effect on the video feed even though I haven’t implemented the decrypt yet. I also am getting this error “too late to create encoded streams” for rtpsender but I’m pretty sure I followed the flow in that blog post.

I can’t remember what was needed, but you most definitely need to tell the PC to use Insertable Streams, and which transform functions should be used (in your case the ones by the SFrame library). You can refer to our e2ee demo and the related code in janus.js for some guidelines.