Kurento无法录制视频,我的代码如下所示,
WebRtcEndpoint webrtcEndpoint =..;
RecorderEndpoint recorderEndpoint = new RecorderEndpoint.Builder(getPipeline(), "file:///tmp/test.webm")
.withMediaProfile(MediaProfileSpecType.WEBM) //I also tried MP4
.stopOnEndOfStream()
.build();
recorderEndpoint.addRecordingListener(new EventListener<RecordingEvent>() {
@Override
public void onEvent(RecordingEvent event) {
log.info("start recording for userId: {}, live:{}", getUserId(), getLiveId());
}
});
recorderEndpoint.addStoppedListener(new EventListener<StoppedEvent>() {
@Override
public void onEvent(StoppedEvent event) {
log.info("stopped recording for userId: {}, live:{}", getUserId(), getLiveId());
}
});
recorderEndpoint.addPausedListener(new EventListener<PausedEvent>() {
@Override
public void onEvent(PausedEvent event) {
log.info("Pause recording for userId: {}, live:{}", getUserId(), getLiveId());
}
});
recorderEndpoint.addErrorListener(new EventListener<ErrorEvent>() {
@Override
public void onEvent(ErrorEvent event) {
log.info("record error: {}, live:{}, event:{}", getUserId(), getLiveId(),event.getType()+ "|" + event.getErrorCode() + ":" + event.getDescription());
}
});
webrtcEndpoint.connect(recorderEndpoint);
log.info("recorderEndpoint.record() called!");
recorderEndpoint.record();
我确定已连接webrtcEndpoint并正常制作视频。
问题是在/ tmp目录中创建了文件test.webm;但它是空的!
当我的android连接到服务器时出现问题。如果我使用浏览器,则没有问题。有什么原因吗?
答案 0 :(得分:0)
最后,我得到了答案。原因是服务端尝试同时连接视频和音频,而客户端(设备)仅发送视频,因此记录无法开始。该问题实际上已在客户端解决。