Kurento can't record video, my code is like below,
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();
I'm sure webrtcEndpoint is connected and make video normally.
The problem is the file test.webm created in the directory /tmp; but it is empty!
The problem appear when my android connect to server. If I use browser, doesn't have the issue. Any reason it can be?
Finally, I got the answer. The reason is the service side try to connect both video and audio, while client (device) only send video, so the record can't start. The issue was actually fixed on client side.