Kurento多对多录制空白视频

时间:2017-06-27 18:50:47

标签: java webrtc kurento

我正在尝试处理为多对多演示编写的代码,同时使用One-to-One w / Recording演示作为参考。我已将以下代码添加到UserSession.java构造函数:

  public static final String RECORDING_PATH = "file:///recordings/";
  public static final String RECORDING_EXT = ".webm";

  public UserSession(final String name, String roomName, final WebSocketSession session, MediaPipeline pipeline) {
    this.pipeline = pipeline;
    this.name = name;
    this.session = session;
    this.roomName = roomName;

    this.outgoingMedia = new WebRtcEndpoint.Builder(pipeline).build();
    this.recorder = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + roomName + '_' + name + RECORDING_EXT).build();

    this.isRecording = false;

在传入的媒体连接到会话的对等方后,我已将此添加到 getEndpointForUser 方法的底部:

sender.getOutgoingWebRtcPeer().connect(incoming);
sender.getOutgoingWebRtcPeer().connect(this.recorder);

我通过套接字调用从浏览器手动触发记录和停止记录,但视频文件始终为空(0kb)。为每个没有任何数据的会话创建正确数量的视频。有没有人知道我可能做错了什么?

1 个答案:

答案 0 :(得分:0)

非常重要,RecorderEndpoint知道正在使用的媒体容器约束配置文件。我的问题是我在开发时关闭了前端媒体限制的音频(令人讨厌)。 RecorderEndpoint需要通过传递正确的MediaProfileSpecType来了解这一点。

this.recorder = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + roomName + '_' + name + RECORDING_EXT)
  .withMediaProfile(MediaProfileSpecType.WEBM)
  .build();

只需返回前端的音频即可修复它,但您也可以参考其他教程中包含的代码,其中Kurento团队根据某种媒体约束容器逻辑连接RecorderEndpoint,您可能需要这些逻辑。一个生产应用程序,适用于有网络摄像头问题但音频或视频无法通过的人。