Combining both canvas capture and device selection

339 views
Skip to first unread message

Oscar Vadillo

unread,
Dec 18, 2020, 7:19:06 AM12/18/20
to meetecho-janus
Hi folks,

I am trying to combine both demos the CanvasCapture and the DeviceSelection.

Both of them are working as a charm on the following links:

But, what happens when we try to combine both demos on the same usecase?
For example, by replacing from a canvas capture stream to a device camera or viceversa.

Well, I've tried it on the EchoTest example but it didn't work.
What I did, it was to stablish a communication by using a camera device, and then to inject a stream by using the createOffer method passing a stream generated from the canvas.captureStream() method.

Please find below the screenshots of the result. At first it seems that the renegotiation is OK, but at the end I got the following response: "Janus stopped receiving our video"


Any idea what might be going on?

Thanks in advance!

k meyerhofer

unread,
Mar 26, 2021, 4:25:56 PM3/26/21
to meetecho-janus
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); },
});
```
Reply all
Reply to author
Forward
0 new messages