I ran into a similar situation as you Oscar. I've created a PR to address this issue (here -
https://github.com/meetecho/janus-gateway/pull/2604)
Ultimately the user's device camera stream never reaches the `removeTrack` or `addTrack` parts of the janus.js code. If you use my branch to test your use case, you can write the `createOffer` like this:
```
// Assume Janus is correctly initialized
var canvas = document.getElementById('canvas');
var stream = canvas.captureStream();
janusPlugin.createOffer({
stream: {
externalStream: stream,
replaceVideo: true,
},
simulcast: false,
simulcast2: false,
success: (jsep) => {
janusPlugin.send({ message: { request: "configure", audio: true, video: true}, jsep });
},
error: (error) => { Janus.error('error', error); },
});
```