Skip to content

Instantly share code, notes, and snippets.

@randallb
Created July 17, 2015 15:16
Show Gist options
  • Select an option

  • Save randallb/bb52e8a57fc560316c2f to your computer and use it in GitHub Desktop.

Select an option

Save randallb/bb52e8a57fc560316c2f to your computer and use it in GitHub Desktop.
Kurento pipeline which only one audio records.
exports.createCompositePipeline = function(hostSdpOffer, guestSdpOffer, callback) {
if (callback == null) {
callback = function() {};
}
console.log("Creating call pipeline");
return client.create('MediaPipeline', function(err, pipeline) {
return pipeline.create('WebRtcEndpoint', function(err, hostWebRtcEndpoint) {
return pipeline.create('WebRtcEndpoint', function(err, guestWebRtcEndpoint) {
return pipeline.create('Composite', function(err, composite) {
return composite.createHubPort(function(err, guestHubPort) {
return composite.createHubPort(function(err, hostHubPort) {
return hostWebRtcEndpoint.connect(hostHubPort, function() {
return guestWebRtcEndpoint.connect(guestHubPort, function() {
return hostHubPort.connect(hostWebRtcEndpoint, function() {
return guestHubPort.connect(guestWebRtcEndpoint, function() {
return hostWebRtcEndpoint.processOffer(hostSdpOffer, function(err, hostAnswer) {
return guestWebRtcEndpoint.processOffer(guestSdpOffer, function(err, guestAnswer) {
console.log("Sending host answer back.");
callback(err, hostAnswer, guestAnswer);
return pipeline.create('RecorderEndpoint', {
uri: "file:///tmp/movie_recordings/composite_sample_clip_" + (getFilename()) + ".webm"
}, function(err, _recorder) {
return hostHubPort.connect(_recorder, function() {
console.log("probably connected everything correctly?");
return _recorder.record(function() {
return console.log("probably recording??");
});
});
});
});
});
});
});
});
});
});
});
});
});
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment