Recording Chrome Extension tabCapture Media Stream

1,614 views
Skip to first unread message

vi...@opentest.co

unread,
Feb 11, 2016, 4:05:25 PM2/11/16
to kurento
Hey Guys,

I'm having problems trying to record the MediaStream returned by Chrome's tabCapture API. I am using pretty much the exact code in the Kurento Node Hello World example. The only differences are:

1. I'm creating a RecorderEndpoint on the server.
2. I'm passing in this tab capture MediaStream object to kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv.

Here's an example of me passing in the tabCapture stream:


chrome.tabCapture.capture({
  video: true,
  audio: false,
  videoConstraints: {
    minFrameRate: 30,
    maxFrameRate: 64
  }
}, function (mediaStream) {
  var options = {
    localVideo: videoInput,
    remoteVideo: videoOutput,
    onicecandidate: onIceCandidate,
    videoStream: mediaStream
  };

  webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function(error) {
    // generate offer and process
  });
});


When I get rid of passing this in as videoStream, the normal example works as expected and gets recorded properly. When I pass in the videoStream like this, I can actually see the local and remote video tags showing the tab capture properly, but the front-facing camera actually gets recorded. Maybe this is an issue with adapter.js not being able to figure out that the video stream passed in is valid?

My eventual goal is to create a WebRtcPeerSendonly connection where I'm only sending and recording the tab video capture (recording what's going on on the current website), but I figured I would keep everything as close to the hello-world example as possible to reduce the amount of variation that might cause any issues.

vi...@opentest.co

unread,
Feb 11, 2016, 6:12:13 PM2/11/16
to kurento
It seems like, if I include "mediaSource": "tabs" and "chromeMediaSource": "tabs" in the constraints, the screens show correctly (and the front facing cam isn't initialized), but it's not recording anything. If I remove them, it records the front-facing cam. Basically I just need a way to attach this tabCapture stream and record it without initializing any other streams. My intuition tells me this is actually a problem with the offer getting sent to KMS. Perhaps the MediaStream object returned by tabCapture is different than ones returned by getUserMedia?

vi...@opentest.co

unread,
Feb 11, 2016, 6:30:53 PM2/11/16
to kurento
Ok I've gotten it to where I am only recording the tab and switched to "Sendonly" rather than "Sendrecv". It is still recording nothing. :-( I'm wondering if this is because Kurento just can't handle the Media Stream object returned by tabCapture. Could this be a possibility? I'm pretty desperate at this point ha.

vi...@opentest.co

unread,
Feb 11, 2016, 8:17:41 PM2/11/16
to kurento
For some reason it is now working. I am extremely excited and worried. I will post any updates here.

vi...@opentest.co

unread,
Feb 12, 2016, 10:28:56 PM2/12/16
to kurento
Ok so it seems as though the issue here was that I was not queuing candidates correctly on the server. :-)

Ivan Gracia

unread,
Feb 13, 2016, 4:28:28 AM2/13/16
to kurento
Good to know you got that solved!
--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vi...@opentest.co

unread,
Feb 13, 2016, 5:20:18 PM2/13/16
to kurento
Definitely. For others who might be playing with different MediaStream sources (tabCapture or other extension APIs) and wants custom frontend/backend code structure that strays from the examples:

1. Start with the hello-world example.
2. Get that working.
3. Attach your stream. If it works, then it's *possible*.
4. Write your own frontend but have it talk to the hello-world example backend in the same way.
5. When you have #4 working, swap out the backend if you want to do anything custom (in my case HTTP requests vs. maintaining a live websocket, Sendonly vs. SendRecv, and adding a RecorderEndpoint).
Reply all
Reply to author
Forward
0 new messages