RecordingDownloader logic

pull/375/head
pabloFuente 2019-06-19 17:45:54 +02:00
parent 3ca64d9cca
commit 78602702b8
7 changed files with 73 additions and 4 deletions

View File

@ -44,6 +44,12 @@ public class Recording {
*/
stopped,
/**
* The recording has stopped but is being processed. This status will change to
* stopped/available or failed
*/
processing,
/**
* The recording is available for downloading. This status is reached for all
* stopped recordings if

View File

@ -115,6 +115,12 @@ export namespace Recording {
*/
stopped = 'stopped',
/**
* The recording has stopped but is being processed. This status will change to
* stopped/available or failed when processing ends
*/
processing = 'processing',
/**
* The recording is available for downloading. This status is reached for all
* stopped recordings if [OpenVidu Server configuration](https://openvidu.io/docs/reference-docs/openvidu-server-params/)

View File

@ -56,6 +56,8 @@ import io.openvidu.server.kurento.kms.DummyLoadManager;
import io.openvidu.server.kurento.kms.FixedOneKmsManager;
import io.openvidu.server.kurento.kms.KmsManager;
import io.openvidu.server.kurento.kms.LoadManager;
import io.openvidu.server.recording.DummyRecordingDownloader;
import io.openvidu.server.recording.RecordingDownloader;
import io.openvidu.server.recording.service.RecordingManager;
import io.openvidu.server.rpc.RpcHandler;
import io.openvidu.server.rpc.RpcNotificationService;
@ -150,6 +152,12 @@ public class OpenViduServer implements JsonRpcConfigurer {
public RecordingManager recordingManager() {
return new RecordingManager();
}
@Bean
@ConditionalOnMissingBean
public RecordingDownloader recordingDownload() {
return new DummyRecordingDownloader();
}
@Bean
@ConditionalOnMissingBean

View File

@ -0,0 +1,13 @@
package io.openvidu.server.recording;
import java.io.IOException;
import java.util.Collection;
public class DummyRecordingDownloader implements RecordingDownloader {
@Override
public void downloadRecording(Recording recording, Collection<String> streamIds) throws IOException {
// Do nothing
}
}

View File

@ -0,0 +1,27 @@
/*
* (C) Copyright 2017-2019 OpenVidu (https://openvidu.io/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package io.openvidu.server.recording;
import java.io.IOException;
import java.util.Collection;
public interface RecordingDownloader {
public void downloadRecording(Recording recording, Collection<String> streamIds) throws IOException;
}

View File

@ -65,6 +65,7 @@ import io.openvidu.server.core.SessionManager;
import io.openvidu.server.kurento.core.KurentoSession;
import io.openvidu.server.kurento.kms.KmsManager;
import io.openvidu.server.recording.Recording;
import io.openvidu.server.recording.RecordingDownloader;
import io.openvidu.server.utils.CustomFileManager;
import io.openvidu.server.utils.DockerManager;
@ -82,6 +83,9 @@ public class RecordingManager {
@Autowired
private SessionManager sessionManager;
@Autowired
private RecordingDownloader recordingDownloader;
@Autowired
protected OpenviduConfig openviduConfig;
@ -109,8 +113,8 @@ public class RecordingManager {
RecordingManager.IMAGE_TAG = openviduConfig.getOpenViduRecordingVersion();
this.dockerManager = new DockerManager();
this.composedRecordingService = new ComposedRecordingService(this, openviduConfig);
this.singleStreamRecordingService = new SingleStreamRecordingService(this, openviduConfig);
this.composedRecordingService = new ComposedRecordingService(this, recordingDownloader, openviduConfig);
this.singleStreamRecordingService = new SingleStreamRecordingService(this, recordingDownloader, openviduConfig);
log.info("Recording module required: Downloading openvidu/openvidu-recording:"
+ openviduConfig.getOpenViduRecordingVersion() + " Docker image (350MB aprox)");
@ -225,7 +229,8 @@ public class RecordingManager {
}
break;
case INDIVIDUAL:
recording = this.singleStreamRecordingService.stopRecording(session, recording, reason, kmsDisconnectionTime);
recording = this.singleStreamRecordingService.stopRecording(session, recording, reason,
kmsDisconnectionTime);
break;
}
this.abortAutomaticRecordingStopThread(session);

View File

@ -30,6 +30,7 @@ import io.openvidu.server.config.OpenviduConfig;
import io.openvidu.server.core.EndReason;
import io.openvidu.server.core.Session;
import io.openvidu.server.recording.Recording;
import io.openvidu.server.recording.RecordingDownloader;
import io.openvidu.server.utils.CommandExecutor;
import io.openvidu.server.utils.CustomFileManager;
@ -39,10 +40,13 @@ public abstract class RecordingService {
protected OpenviduConfig openviduConfig;
protected RecordingManager recordingManager;
protected RecordingDownloader recordingDownloader;
protected CustomFileManager fileWriter = new CustomFileManager();
RecordingService(RecordingManager recordingManager, OpenviduConfig openviduConfig) {
RecordingService(RecordingManager recordingManager, RecordingDownloader recordingDownloader,
OpenviduConfig openviduConfig) {
this.recordingManager = recordingManager;
this.recordingDownloader = recordingDownloader;
this.openviduConfig = openviduConfig;
}