mirror of https://github.com/OpenVidu/openvidu.git
openvidu-java-client Recording.name
parent
6a057f28e6
commit
84045f82d4
|
@ -75,7 +75,7 @@ public class OpenVidu {
|
|||
|
||||
this.myHttpClient = HttpClients.custom().setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
|
||||
.setSSLContext(sslContext).setDefaultCredentialsProvider(provider).build();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Session createSession() throws OpenViduException {
|
||||
|
@ -89,12 +89,13 @@ public class OpenVidu {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Recording startRecording(String sessionId) throws OpenViduException {
|
||||
public Recording startRecording(String sessionId, RecordingProperties properties) throws OpenViduException {
|
||||
try {
|
||||
HttpPost request = new HttpPost(this.urlOpenViduServer + API_RECORDINGS + API_RECORDINGS_START);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("session", sessionId);
|
||||
json.put("name", properties.name());
|
||||
StringEntity params = new StringEntity(json.toString());
|
||||
|
||||
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
|
||||
|
@ -114,6 +115,17 @@ public class OpenVidu {
|
|||
}
|
||||
}
|
||||
|
||||
public Recording startRecording(String sessionId, String name) throws OpenViduException {
|
||||
if (name == null) {
|
||||
name = "";
|
||||
}
|
||||
return this.startRecording(sessionId, new RecordingProperties.Builder().name(name).build());
|
||||
}
|
||||
|
||||
public Recording startRecording(String sessionId) throws OpenViduException {
|
||||
return this.startRecording(sessionId, "");
|
||||
}
|
||||
|
||||
public Recording stopRecording(String recordingId) throws OpenViduException {
|
||||
try {
|
||||
HttpPost request = new HttpPost(
|
||||
|
@ -144,7 +156,8 @@ public class OpenVidu {
|
|||
throw new OpenViduException(Code.RECORDING_LIST_ERROR_CODE, Integer.toString(statusCode));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new OpenViduException(Code.RECORDING_LIST_ERROR_CODE, "Unable to get recording '" + recordingId + "': " + e.getMessage());
|
||||
throw new OpenViduException(Code.RECORDING_LIST_ERROR_CODE,
|
||||
"Unable to get recording '" + recordingId + "': " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package io.openvidu.java.client;
|
||||
|
||||
public class RecordingProperties {
|
||||
|
||||
private String name;
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private String name = "";
|
||||
|
||||
public RecordingProperties build() {
|
||||
return new RecordingProperties(this.name);
|
||||
}
|
||||
|
||||
public RecordingProperties.Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected RecordingProperties(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue