复合录制会创建空视频

时间:2016-01-16 04:34:21

标签: java webrtc kurento

这是我使用java创建复合视频录制的代码。但它会创建空白视频。不播放流。为什么?

mp       = kurento.createMediaPipeline();

WebRtcEndpoint webRtcEPRed = new WebRtcEndpoint.Builder(mp).build();
WebRtcEndpoint webRtcEPGreen = new WebRtcEndpoint.Builder(mp).build();

Composite composite = new Composite.Builder(mp).build();
HubPort hubPort1 = new HubPort.Builder(composite).build();
HubPort hubPort2 = new HubPort.Builder(composite).build();
HubPort hubPort3 = new HubPort.Builder(composite).build();

RecorderEndpoint recorderEP =
    new RecorderEndpoint.Builder(mp, RECORDING_PATH + "twoside" + RECORDING_EXT).build();


webRtcEPRed.connect(hubPort1);
webRtcEPGreen.connect(hubPort2);

hubPort3.connect(recorderEP);

recorderEP.record();

1 个答案:

答案 0 :(得分:1)

我按如下方式更改了代码,现在工作正常

  // Media pipeline
    pipeline = kurento.createMediaPipeline();


    Composite composite = new Composite.Builder(pipeline).build();

    HubPort hubPort1 = new HubPort.Builder(composite).build();
    HubPort hubPort2 = new HubPort.Builder(composite).build();
    HubPort hubPort3 = new HubPort.Builder(composite).build();

    recorderEP =  new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + "twosidess" + RECORDING_EXT).build();

    webRtcCaller.connect(webRtcCallee);
    webRtcCaller.connect(recorderEP);

    webRtcCaller.connect(hubPort1);
    webRtcCallee.connect(hubPort2);

    webRtcCallee.connect(webRtcCaller);

    hubPort3.connect(recorderEP);
    recorderEP.record();