mirror of https://github.com/OpenVidu/openvidu.git
Rename ConnectionOptions to ConnectionProperties
parent
ab9725bd45
commit
c5ae79b3a9
|
@ -39,7 +39,7 @@ public class Connection {
|
|||
private String location;
|
||||
private String platform;
|
||||
private String clientData;
|
||||
private ConnectionOptions connectionOptions;
|
||||
private ConnectionProperties connectionProperties;
|
||||
private String token;
|
||||
|
||||
protected Map<String, Publisher> publishers = new ConcurrentHashMap<>();
|
||||
|
@ -95,7 +95,7 @@ public class Connection {
|
|||
* Returns the type of Connection.
|
||||
*/
|
||||
public ConnectionType getType() {
|
||||
return this.connectionOptions.getType();
|
||||
return this.connectionProperties.getType();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +104,7 @@ public class Connection {
|
|||
* when calling {@link io.openvidu.java.client.Session#generateToken()}
|
||||
*/
|
||||
public String getServerData() {
|
||||
return this.connectionOptions.getData();
|
||||
return this.connectionProperties.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,7 +114,7 @@ public class Connection {
|
|||
* target="_blank">INDIVIDUAL recording</a>.
|
||||
*/
|
||||
public boolean record() {
|
||||
return this.connectionOptions.record();
|
||||
return this.connectionProperties.record();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,7 +126,7 @@ public class Connection {
|
|||
* {@link io.openvidu.java.client.ConnectionType#WEBRTC}</strong>
|
||||
*/
|
||||
public OpenViduRole getRole() {
|
||||
return this.connectionOptions.getRole();
|
||||
return this.connectionProperties.getRole();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,7 +138,7 @@ public class Connection {
|
|||
* {@link io.openvidu.java.client.ConnectionType#IPCAM}</strong>
|
||||
*/
|
||||
public String getRtspUri() {
|
||||
return this.connectionOptions.getRtspUri();
|
||||
return this.connectionProperties.getRtspUri();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,7 +154,7 @@ public class Connection {
|
|||
* {@link io.openvidu.java.client.ConnectionType#IPCAM}</strong>
|
||||
*/
|
||||
public boolean adaptativeBitrate() {
|
||||
return this.connectionOptions.adaptativeBitrate();
|
||||
return this.connectionProperties.adaptativeBitrate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,7 +170,7 @@ public class Connection {
|
|||
* {@link io.openvidu.java.client.ConnectionType#IPCAM}</strong>
|
||||
*/
|
||||
public boolean onlyPlayWithSubscribers() {
|
||||
return this.connectionOptions.onlyPlayWithSubscribers();
|
||||
return this.connectionProperties.onlyPlayWithSubscribers();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +186,7 @@ public class Connection {
|
|||
* {@link io.openvidu.java.client.ConnectionType#IPCAM}</strong>
|
||||
*/
|
||||
public int getNetworkCache() {
|
||||
return this.connectionOptions.getNetworkCache();
|
||||
return this.connectionProperties.getNetworkCache();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,11 +262,11 @@ public class Connection {
|
|||
json.addProperty("clientData", this.getClientData());
|
||||
json.addProperty("token", this.getToken());
|
||||
|
||||
JsonObject jsonConnectionOptions = this.connectionOptions.toJson("");
|
||||
jsonConnectionOptions.remove("session");
|
||||
json.addProperty("serverData", jsonConnectionOptions.get("data").getAsString());
|
||||
jsonConnectionOptions.remove("data");
|
||||
jsonConnectionOptions.entrySet().forEach(entry -> {
|
||||
JsonObject jsonConnectionProperties = this.connectionProperties.toJson("");
|
||||
jsonConnectionProperties.remove("session");
|
||||
json.addProperty("serverData", jsonConnectionProperties.get("data").getAsString());
|
||||
jsonConnectionProperties.remove("data");
|
||||
jsonConnectionProperties.entrySet().forEach(entry -> {
|
||||
json.add(entry.getKey(), entry.getValue());
|
||||
});
|
||||
|
||||
|
@ -283,33 +283,33 @@ public class Connection {
|
|||
return json;
|
||||
}
|
||||
|
||||
protected void overrideConnectionOptions(ConnectionOptions newConnectionOptions) {
|
||||
ConnectionOptions.Builder builder = new ConnectionOptions.Builder();
|
||||
protected void overrideConnectionProperties(ConnectionProperties newConnectionProperties) {
|
||||
ConnectionProperties.Builder builder = new ConnectionProperties.Builder();
|
||||
// For now only properties role and record can be updated
|
||||
if (newConnectionOptions.getRole() != null) {
|
||||
builder.role(newConnectionOptions.getRole());
|
||||
if (newConnectionProperties.getRole() != null) {
|
||||
builder.role(newConnectionProperties.getRole());
|
||||
} else {
|
||||
builder.role(this.connectionOptions.getRole());
|
||||
builder.role(this.connectionProperties.getRole());
|
||||
}
|
||||
if (newConnectionOptions.record() != null) {
|
||||
builder.record(newConnectionOptions.record());
|
||||
if (newConnectionProperties.record() != null) {
|
||||
builder.record(newConnectionProperties.record());
|
||||
} else {
|
||||
builder.record(this.connectionOptions.record());
|
||||
builder.record(this.connectionProperties.record());
|
||||
}
|
||||
// Keep old configuration in the rest of properties
|
||||
builder.type(this.connectionOptions.getType()).data(this.connectionOptions.getData())
|
||||
.kurentoOptions(this.connectionOptions.getKurentoOptions())
|
||||
.rtspUri(this.connectionOptions.getRtspUri());
|
||||
if (this.connectionOptions.adaptativeBitrate() != null) {
|
||||
builder.adaptativeBitrate(this.connectionOptions.adaptativeBitrate());
|
||||
builder.type(this.connectionProperties.getType()).data(this.connectionProperties.getData())
|
||||
.kurentoOptions(this.connectionProperties.getKurentoOptions())
|
||||
.rtspUri(this.connectionProperties.getRtspUri());
|
||||
if (this.connectionProperties.adaptativeBitrate() != null) {
|
||||
builder.adaptativeBitrate(this.connectionProperties.adaptativeBitrate());
|
||||
}
|
||||
if (this.connectionOptions.onlyPlayWithSubscribers() != null) {
|
||||
builder.onlyPlayWithSubscribers(this.connectionOptions.onlyPlayWithSubscribers());
|
||||
if (this.connectionProperties.onlyPlayWithSubscribers() != null) {
|
||||
builder.onlyPlayWithSubscribers(this.connectionProperties.onlyPlayWithSubscribers());
|
||||
}
|
||||
if (this.connectionOptions.getNetworkCache() != null) {
|
||||
builder.networkCache(this.connectionOptions.getNetworkCache());
|
||||
if (this.connectionProperties.getNetworkCache() != null) {
|
||||
builder.networkCache(this.connectionProperties.getNetworkCache());
|
||||
}
|
||||
this.connectionOptions = builder.build();
|
||||
this.connectionProperties = builder.build();
|
||||
}
|
||||
|
||||
protected void setSubscribers(List<String> subscribers) {
|
||||
|
@ -412,7 +412,7 @@ public class Connection {
|
|||
Integer networkCache = (json.has("networkCache") && !json.get("networkCache").isJsonNull())
|
||||
? json.get("networkCache").getAsInt()
|
||||
: null;
|
||||
this.connectionOptions = new ConnectionOptions(type, data, record, role, null, rtspUri, adaptativeBitrate,
|
||||
this.connectionProperties = new ConnectionProperties(type, data, record, role, null, rtspUri, adaptativeBitrate,
|
||||
onlyPlayWithSubscribers, networkCache);
|
||||
|
||||
return this;
|
||||
|
|
|
@ -5,9 +5,9 @@ import com.google.gson.JsonObject;
|
|||
|
||||
/**
|
||||
* See
|
||||
* {@link io.openvidu.java.client.Session#createConnection(ConnectionOptions)}
|
||||
* {@link io.openvidu.java.client.Session#createConnection(ConnectionProperties)}
|
||||
*/
|
||||
public class ConnectionOptions {
|
||||
public class ConnectionProperties {
|
||||
|
||||
private ConnectionType type;
|
||||
// COMMON
|
||||
|
@ -24,7 +24,7 @@ public class ConnectionOptions {
|
|||
|
||||
/**
|
||||
*
|
||||
* Builder for {@link io.openvidu.java.client.ConnectionOptions}
|
||||
* Builder for {@link io.openvidu.java.client.ConnectionProperties}
|
||||
*
|
||||
*/
|
||||
public static class Builder {
|
||||
|
@ -43,10 +43,10 @@ public class ConnectionOptions {
|
|||
private Integer networkCache;
|
||||
|
||||
/**
|
||||
* Builder for {@link io.openvidu.java.client.ConnectionOptions}.
|
||||
* Builder for {@link io.openvidu.java.client.ConnectionProperties}.
|
||||
*/
|
||||
public ConnectionOptions build() {
|
||||
return new ConnectionOptions(this.type, this.data, this.record, this.role, this.kurentoOptions,
|
||||
public ConnectionProperties build() {
|
||||
return new ConnectionProperties(this.type, this.data, this.record, this.role, this.kurentoOptions,
|
||||
this.rtspUri, this.adaptativeBitrate, this.onlyPlayWithSubscribers, this.networkCache);
|
||||
}
|
||||
|
||||
|
@ -56,24 +56,24 @@ public class ConnectionOptions {
|
|||
* have effect:
|
||||
* <ul>
|
||||
* <li>{@link io.openvidu.java.client.ConnectionType#WEBRTC}:
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#data(String) data},
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#record(boolean)
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#data(String) data},
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#record(boolean)
|
||||
* record},
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#role(OpenViduRole)
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#role(OpenViduRole)
|
||||
* role},
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#kurentoOptions(KurentoOptions)
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#kurentoOptions(KurentoOptions)
|
||||
* kurentoOptions}</li>
|
||||
* <li>{@link io.openvidu.java.client.ConnectionType#IPCAM}:
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#data(String) data},
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#record(boolean)
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#data(String) data},
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#record(boolean)
|
||||
* record},
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#rtspUri(String)
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#rtspUri(String)
|
||||
* rtspUri},
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#adaptativeBitrate(boolean)
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#adaptativeBitrate(boolean)
|
||||
* adaptativeBitrate},
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#onlyPlayWithSubscribers(boolean)
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#onlyPlayWithSubscribers(boolean)
|
||||
* onlyPlayWithSubscribers},
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#networkCache(int)
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#networkCache(int)
|
||||
* networkCache}</li>
|
||||
* </ul>
|
||||
* If not set by default will be @link
|
||||
|
@ -94,7 +94,7 @@ public class ConnectionOptions {
|
|||
* <li>If you have provided no data in your clients when calling method
|
||||
* <code>Session.connect(TOKEN, DATA)</code> (<code>DATA</code> not defined),
|
||||
* then <code>Connection.data</code> will only have this
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#data(String)}
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#data(String)}
|
||||
* property.</li>
|
||||
* <li>If you have provided some data when calling
|
||||
* <code>Session.connect(TOKEN, DATA)</code> (<code>DATA</code> defined), then
|
||||
|
@ -102,7 +102,7 @@ public class ConnectionOptions {
|
|||
* <code>"CLIENT_DATA%/%SERVER_DATA"</code>, being
|
||||
* <code>CLIENT_DATA</code> the second parameter passed in OpenVidu Browser in
|
||||
* method <code>Session.connect</code> and <code>SERVER_DATA</code> this
|
||||
* {@link io.openvidu.java.client.ConnectionOptions.Builder#data(String)}
|
||||
* {@link io.openvidu.java.client.ConnectionProperties.Builder#data(String)}
|
||||
* property.</li>
|
||||
* </ul>
|
||||
*/
|
||||
|
@ -219,7 +219,7 @@ public class ConnectionOptions {
|
|||
}
|
||||
}
|
||||
|
||||
ConnectionOptions(ConnectionType type, String data, Boolean record, OpenViduRole role,
|
||||
ConnectionProperties(ConnectionType type, String data, Boolean record, OpenViduRole role,
|
||||
KurentoOptions kurentoOptions, String rtspUri, Boolean adaptativeBitrate, Boolean onlyPlayWithSubscribers,
|
||||
Integer networkCache) {
|
||||
this.type = type;
|
|
@ -105,8 +105,8 @@ public class Session {
|
|||
|
||||
/**
|
||||
* @deprecated Use
|
||||
* {@link Session#createConnection(io.openvidu.java.client.ConnectionOptions)
|
||||
* Session.createConnection(ConnectionOptions)} instead to get a
|
||||
* {@link Session#createConnection(io.openvidu.java.client.ConnectionProperties)
|
||||
* Session.createConnection(ConnectionProperties)} instead to get a
|
||||
* {@link io.openvidu.java.client.Connection} object.
|
||||
*
|
||||
* @return The generated token String
|
||||
|
@ -155,8 +155,8 @@ public class Session {
|
|||
|
||||
/**
|
||||
* Same as
|
||||
* {@link io.openvidu.java.client.Session#createConnection(ConnectionOptions)
|
||||
* but with default ConnectionOptions values.
|
||||
* {@link io.openvidu.java.client.Session#createConnection(ConnectionProperties)
|
||||
* but with default ConnectionProperties values.
|
||||
*
|
||||
* @return The generated {@link io.openvidu.java.client.Connection Connection}
|
||||
* object.
|
||||
|
@ -166,12 +166,12 @@ public class Session {
|
|||
*/
|
||||
public Connection createConnection() throws OpenViduJavaClientException, OpenViduHttpException {
|
||||
return createConnection(
|
||||
new ConnectionOptions.Builder().data("").role(OpenViduRole.PUBLISHER).record(true).build());
|
||||
new ConnectionProperties.Builder().data("").role(OpenViduRole.PUBLISHER).record(true).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Connection object associated to Session object and configured
|
||||
* with <code>connectionOptions</code>. Each user connecting to the Session
|
||||
* with <code>connectionProperties</code>. Each user connecting to the Session
|
||||
* requires a Connection. The token string value to send to the client side can
|
||||
* be retrieved with {@link io.openvidu.java.client.Connection#getToken()
|
||||
* Connection.getToken()}.
|
||||
|
@ -182,7 +182,7 @@ public class Session {
|
|||
* @throws OpenViduJavaClientException
|
||||
* @throws OpenViduHttpException
|
||||
*/
|
||||
public Connection createConnection(ConnectionOptions connectionOptions)
|
||||
public Connection createConnection(ConnectionProperties connectionProperties)
|
||||
throws OpenViduJavaClientException, OpenViduHttpException {
|
||||
if (!this.hasSessionId()) {
|
||||
this.getSessionId();
|
||||
|
@ -193,7 +193,7 @@ public class Session {
|
|||
|
||||
StringEntity params;
|
||||
try {
|
||||
params = new StringEntity(connectionOptions.toJson(sessionId).toString());
|
||||
params = new StringEntity(connectionProperties.toJson(sessionId).toString());
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
throw new OpenViduJavaClientException(e1.getMessage(), e1.getCause());
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ public class Session {
|
|||
* those values to call
|
||||
* {@link io.openvidu.java.client.Session#forceDisconnect(Connection)},
|
||||
* {@link io.openvidu.java.client.Session#forceUnpublish(Publisher)} or
|
||||
* {@link io.openvidu.java.client.Session#updateConnection(String, ConnectionOptions)}.<br>
|
||||
* {@link io.openvidu.java.client.Session#updateConnection(String, ConnectionProperties)}.<br>
|
||||
* <br>
|
||||
*
|
||||
* To update all Session objects owned by OpenVidu object at once, call
|
||||
|
@ -338,7 +338,7 @@ public class Session {
|
|||
|
||||
/**
|
||||
* Same as {@link io.openvidu.java.client.Session#forceDisconnect(Connection)
|
||||
* forceDisconnect(ConnectionOptions)} but providing the
|
||||
* forceDisconnect(ConnectionProperties)} but providing the
|
||||
* {@link io.openvidu.java.client.Connection#getConnectionId() connectionId}
|
||||
* instead of the Connection object.
|
||||
*
|
||||
|
@ -464,13 +464,13 @@ public class Session {
|
|||
|
||||
/**
|
||||
* Updates the properties of a Connection with a
|
||||
* {@link io.openvidu.java.client.ConnectionOptions} object. Only these
|
||||
* {@link io.openvidu.java.client.ConnectionProperties} object. Only these
|
||||
* properties can be updated:
|
||||
* <ul>
|
||||
* <li>{@link io.openvidu.java.client.ConnectionOptions.Builder#role(OpenViduRole)
|
||||
* ConnectionOptions.Builder.role(OpenViduRole)}</li>
|
||||
* <li>{@link io.openvidu.java.client.ConnectionOptions.Builder#record(boolean)
|
||||
* ConnectionOptions.Builder.record(boolean)}</li>
|
||||
* <li>{@link io.openvidu.java.client.ConnectionProperties.Builder#role(OpenViduRole)
|
||||
* ConnectionProperties.Builder.role(OpenViduRole)}</li>
|
||||
* <li>{@link io.openvidu.java.client.ConnectionProperties.Builder#record(boolean)
|
||||
* ConnectionProperties.Builder.record(boolean)}</li>
|
||||
* </ul>
|
||||
* <br>
|
||||
*
|
||||
|
@ -482,7 +482,7 @@ public class Session {
|
|||
* objects.
|
||||
*
|
||||
* @param connectionId The Connection to modify
|
||||
* @param connectionOptions A ConnectionOptions object with the new values to
|
||||
* @param connectionProperties A ConnectionProperties object with the new values to
|
||||
* apply
|
||||
*
|
||||
* @return The updated {@link io.openvidu.java.client.Connection Connection}
|
||||
|
@ -491,7 +491,7 @@ public class Session {
|
|||
* @throws OpenViduJavaClientException
|
||||
* @throws OpenViduHttpException
|
||||
*/
|
||||
public Connection updateConnection(String connectionId, ConnectionOptions connectionOptions)
|
||||
public Connection updateConnection(String connectionId, ConnectionProperties connectionProperties)
|
||||
throws OpenViduJavaClientException, OpenViduHttpException {
|
||||
|
||||
HttpPatch request = new HttpPatch(
|
||||
|
@ -499,7 +499,7 @@ public class Session {
|
|||
|
||||
StringEntity params;
|
||||
try {
|
||||
params = new StringEntity(connectionOptions.toJson(this.sessionId).toString());
|
||||
params = new StringEntity(connectionProperties.toJson(this.sessionId).toString());
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
throw new OpenViduJavaClientException(e1.getMessage(), e1.getCause());
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ public class Session {
|
|||
return newConnection;
|
||||
} else {
|
||||
// The updated Connection was available in local map
|
||||
existingConnection.overrideConnectionOptions(connectionOptions);
|
||||
existingConnection.overrideConnectionProperties(connectionProperties);
|
||||
return existingConnection;
|
||||
}
|
||||
|
||||
|
@ -572,15 +572,15 @@ public class Session {
|
|||
* called</strong>. Exceptions to this rule are:
|
||||
* <ul>
|
||||
* <li>Calling
|
||||
* {@link io.openvidu.java.client.Session#createConnection(ConnectionOptions)
|
||||
* createConnection(ConnectionOptions)} automatically adds the new Connection
|
||||
* {@link io.openvidu.java.client.Session#createConnection(ConnectionProperties)
|
||||
* createConnection(ConnectionProperties)} automatically adds the new Connection
|
||||
* object to the local collection.</li>
|
||||
* <li>Calling {@link io.openvidu.java.client.Session#forceUnpublish(String)}
|
||||
* automatically updates each affected local Connection object.</li>
|
||||
* <li>Calling {@link io.openvidu.java.client.Session#forceDisconnect(String)}
|
||||
* automatically updates each affected local Connection object.</li>
|
||||
* <li>Calling
|
||||
* {@link io.openvidu.java.client.Session#updateConnection(String, ConnectionOptions)}
|
||||
* {@link io.openvidu.java.client.Session#updateConnection(String, ConnectionProperties)}
|
||||
* automatically updates the attributes of the affected local Connection
|
||||
* object.</li>
|
||||
* </ul>
|
||||
|
@ -604,15 +604,15 @@ public class Session {
|
|||
* called</strong>. Exceptions to this rule are:
|
||||
* <ul>
|
||||
* <li>Calling
|
||||
* {@link io.openvidu.java.client.Session#createConnection(ConnectionOptions)
|
||||
* createConnection(ConnectionOptions)} automatically adds the new Connection
|
||||
* {@link io.openvidu.java.client.Session#createConnection(ConnectionProperties)
|
||||
* createConnection(ConnectionProperties)} automatically adds the new Connection
|
||||
* object to the local collection.</li>
|
||||
* <li>Calling {@link io.openvidu.java.client.Session#forceUnpublish(String)}
|
||||
* automatically updates each affected local Connection object.</li>
|
||||
* <li>Calling {@link io.openvidu.java.client.Session#forceDisconnect(String)}
|
||||
* automatically updates each affected local Connection object.</li>
|
||||
* <li>Calling
|
||||
* {@link io.openvidu.java.client.Session#updateConnection(String, ConnectionOptions)}
|
||||
* {@link io.openvidu.java.client.Session#updateConnection(String, ConnectionProperties)}
|
||||
* automatically updates the attributes of the affected local Connection
|
||||
* object.</li>
|
||||
* </ul>
|
||||
|
|
|
@ -21,8 +21,8 @@ import com.google.gson.JsonNull;
|
|||
import com.google.gson.JsonObject;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link io.openvidu.java.client.ConnectionOptions
|
||||
* ConnectionOptions} instead
|
||||
* @deprecated Use {@link io.openvidu.java.client.ConnectionProperties
|
||||
* ConnectionProperties} instead
|
||||
*/
|
||||
public class TokenOptions {
|
||||
|
||||
|
@ -32,8 +32,8 @@ public class TokenOptions {
|
|||
private KurentoOptions kurentoOptions;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link io.openvidu.java.client.ConnectionOptions.Builder
|
||||
* ConnectionOptions.Builder} instead
|
||||
* @deprecated Use {@link io.openvidu.java.client.ConnectionProperties.Builder
|
||||
* ConnectionProperties.Builder} instead
|
||||
*/
|
||||
public static class Builder {
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
import { Publisher } from './Publisher';
|
||||
import { ConnectionOptions } from './ConnectionOptions';
|
||||
import { ConnectionProperties } from './ConnectionProperties';
|
||||
import { OpenViduRole } from './OpenViduRole';
|
||||
|
||||
/**
|
||||
|
@ -71,9 +71,9 @@ export class Connection {
|
|||
clientData: string;
|
||||
|
||||
/**
|
||||
* The [[ConnectionOptions]] assigned to the Connection
|
||||
* The [[ConnectionProperties]] assigned to the Connection
|
||||
*/
|
||||
connectionOptions: ConnectionOptions;
|
||||
connectionProperties: ConnectionProperties;
|
||||
|
||||
/**
|
||||
* Token associated to the Connection
|
||||
|
@ -93,11 +93,11 @@ export class Connection {
|
|||
subscribers: string[] = [];
|
||||
|
||||
/**
|
||||
* @hidden deprecated. Inside ConnectionOptions
|
||||
* @hidden deprecated. Inside ConnectionProperties
|
||||
*/
|
||||
role?: OpenViduRole;
|
||||
/**
|
||||
* @hidden deprecated. Inside ConnectionOptions
|
||||
* @hidden deprecated. Inside ConnectionProperties
|
||||
*/
|
||||
serverData?: string;
|
||||
|
||||
|
@ -121,18 +121,18 @@ export class Connection {
|
|||
this.platform = json.platform;
|
||||
this.clientData = json.clientData;
|
||||
this.token = json.token;
|
||||
if (this.connectionOptions != null) {
|
||||
this.connectionOptions.type = json.type;
|
||||
this.connectionOptions.data = json.data;
|
||||
this.connectionOptions.record = json.record;
|
||||
this.connectionOptions.role = json.role;
|
||||
this.connectionOptions.kurentoOptions = json.kurentoOptions;
|
||||
this.connectionOptions.rtspUri = json.rtspUri;
|
||||
this.connectionOptions.adaptativeBitrate = json.adaptativeBitrate;
|
||||
this.connectionOptions.onlyPlayWithSubscribers = json.onlyPlayWithSubscribers;
|
||||
this.connectionOptions.networkCache = json.networkCache;
|
||||
if (this.connectionProperties != null) {
|
||||
this.connectionProperties.type = json.type;
|
||||
this.connectionProperties.data = json.data;
|
||||
this.connectionProperties.record = json.record;
|
||||
this.connectionProperties.role = json.role;
|
||||
this.connectionProperties.kurentoOptions = json.kurentoOptions;
|
||||
this.connectionProperties.rtspUri = json.rtspUri;
|
||||
this.connectionProperties.adaptativeBitrate = json.adaptativeBitrate;
|
||||
this.connectionProperties.onlyPlayWithSubscribers = json.onlyPlayWithSubscribers;
|
||||
this.connectionProperties.networkCache = json.networkCache;
|
||||
} else {
|
||||
this.connectionOptions = {
|
||||
this.connectionProperties = {
|
||||
type: json.type,
|
||||
data: json.data,
|
||||
record: json.record,
|
||||
|
@ -209,14 +209,14 @@ export class Connection {
|
|||
this.status === other.status &&
|
||||
this.createdAt === other.createdAt &&
|
||||
this.activeAt === other.activeAt &&
|
||||
this.connectionOptions.type === other.connectionOptions.type &&
|
||||
this.connectionOptions.data === other.connectionOptions.data &&
|
||||
this.connectionOptions.record === other.connectionOptions.record &&
|
||||
this.connectionOptions.role === other.connectionOptions.role &&
|
||||
this.connectionOptions.rtspUri === other.connectionOptions.rtspUri &&
|
||||
this.connectionOptions.adaptativeBitrate === other.connectionOptions.adaptativeBitrate &&
|
||||
this.connectionOptions.onlyPlayWithSubscribers === other.connectionOptions.onlyPlayWithSubscribers &&
|
||||
this.connectionOptions.networkCache === other.connectionOptions.networkCache &&
|
||||
this.connectionProperties.type === other.connectionProperties.type &&
|
||||
this.connectionProperties.data === other.connectionProperties.data &&
|
||||
this.connectionProperties.record === other.connectionProperties.record &&
|
||||
this.connectionProperties.role === other.connectionProperties.role &&
|
||||
this.connectionProperties.rtspUri === other.connectionProperties.rtspUri &&
|
||||
this.connectionProperties.adaptativeBitrate === other.connectionProperties.adaptativeBitrate &&
|
||||
this.connectionProperties.onlyPlayWithSubscribers === other.connectionProperties.onlyPlayWithSubscribers &&
|
||||
this.connectionProperties.networkCache === other.connectionProperties.networkCache &&
|
||||
this.token === other.token &&
|
||||
this.location === other.location &&
|
||||
this.platform === other.platform &&
|
||||
|
@ -224,10 +224,10 @@ export class Connection {
|
|||
this.subscribers.length === other.subscribers.length &&
|
||||
this.publishers.length === other.publishers.length);
|
||||
if (equals) {
|
||||
if (this.connectionOptions.kurentoOptions != null) {
|
||||
equals = JSON.stringify(this.connectionOptions.kurentoOptions) === JSON.stringify(other.connectionOptions.kurentoOptions);
|
||||
if (this.connectionProperties.kurentoOptions != null) {
|
||||
equals = JSON.stringify(this.connectionProperties.kurentoOptions) === JSON.stringify(other.connectionProperties.kurentoOptions);
|
||||
} else {
|
||||
equals = (this.connectionOptions.kurentoOptions === other.connectionOptions.kurentoOptions);
|
||||
equals = (this.connectionProperties.kurentoOptions === other.connectionProperties.kurentoOptions);
|
||||
}
|
||||
}
|
||||
if (equals) {
|
||||
|
@ -250,13 +250,13 @@ export class Connection {
|
|||
/**
|
||||
* @hidden
|
||||
*/
|
||||
overrideConnectionOptions(newConnectionOptions: ConnectionOptions): void {
|
||||
overrideConnectionProperties(newConnectionProperties: ConnectionProperties): void {
|
||||
// For now only properties record and role
|
||||
if (newConnectionOptions.record != null) {
|
||||
this.connectionOptions.record = newConnectionOptions.record;
|
||||
if (newConnectionProperties.record != null) {
|
||||
this.connectionProperties.record = newConnectionProperties.record;
|
||||
}
|
||||
if (newConnectionOptions.role != null) {
|
||||
this.connectionOptions.role = newConnectionOptions.role;
|
||||
if (newConnectionProperties.role != null) {
|
||||
this.connectionProperties.role = newConnectionProperties.role;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
import { ConnectionType } from './ConnectionType';
|
||||
import { OpenViduRole } from './OpenViduRole';
|
||||
|
||||
export interface ConnectionOptions {
|
||||
export interface ConnectionProperties {
|
||||
|
||||
/**
|
||||
* Type of Connection. The [[ConnectionType]] dictates what properties will have effect:
|
||||
|
@ -32,9 +32,9 @@ export interface ConnectionOptions {
|
|||
|
||||
/**
|
||||
* Secure (server-side) data associated to this Connection. Every client will receive this data in property `Connection.data`. Object `Connection` can be retrieved by subscribing to event `connectionCreated` of Session object.
|
||||
* - If you have provided no data in your clients when calling method `Session.connect(TOKEN, DATA)` (`DATA` not defined), then `Connection.data` will only have this [[ConnectionOptions.data]] property.
|
||||
* - If you have provided no data in your clients when calling method `Session.connect(TOKEN, DATA)` (`DATA` not defined), then `Connection.data` will only have this [[ConnectionProperties.data]] property.
|
||||
* - If you have provided some data when calling `Session.connect(TOKEN, DATA)` (`DATA` defined), then `Connection.data` will have the following structure: `"CLIENT_DATA%/%SERVER_DATA"`, being `CLIENT_DATA` the second
|
||||
* parameter passed in OpenVidu Browser in method `Session.connect` and `SERVER_DATA` this [[ConnectionOptions.data]] property.
|
||||
* parameter passed in OpenVidu Browser in method `Session.connect` and `SERVER_DATA` this [[ConnectionProperties.data]] property.
|
||||
*/
|
||||
data?: string;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
import axios, { AxiosError } from 'axios';
|
||||
import { Connection } from './Connection';
|
||||
import { ConnectionOptions } from './ConnectionOptions';
|
||||
import { ConnectionProperties } from './ConnectionProperties';
|
||||
import { MediaMode } from './MediaMode';
|
||||
import { OpenVidu } from './OpenVidu';
|
||||
import { Publisher } from './Publisher';
|
||||
|
@ -143,18 +143,18 @@ export class Session {
|
|||
|
||||
/**
|
||||
* Creates a new Connection object associated to Session object and configured with
|
||||
* `connectionOptions`. Each user connecting to the Session requires a Connection.
|
||||
* `connectionProperties`. Each user connecting to the Session requires a Connection.
|
||||
* The token string value to send to the client side is available at [[Connection.token]].
|
||||
*
|
||||
* @returns A Promise that is resolved to the generated [[Connection]] object if success and rejected with an Error object if not
|
||||
*/
|
||||
public createConnection(connectionOptions?: ConnectionOptions): Promise<Connection> {
|
||||
public createConnection(connectionProperties?: ConnectionProperties): Promise<Connection> {
|
||||
return new Promise<Connection>((resolve, reject) => {
|
||||
const data = JSON.stringify({
|
||||
role: (!!connectionOptions && !!connectionOptions.role) ? connectionOptions.role : null,
|
||||
data: (!!connectionOptions && !!connectionOptions.data) ? connectionOptions.data : null,
|
||||
record: !!connectionOptions ? connectionOptions.record : null,
|
||||
kurentoOptions: (!!connectionOptions && !!connectionOptions.kurentoOptions) ? connectionOptions.kurentoOptions : null
|
||||
role: (!!connectionProperties && !!connectionProperties.role) ? connectionProperties.role : null,
|
||||
data: (!!connectionProperties && !!connectionProperties.data) ? connectionProperties.data : null,
|
||||
record: !!connectionProperties ? connectionProperties.record : null,
|
||||
kurentoOptions: (!!connectionProperties && !!connectionProperties.kurentoOptions) ? connectionProperties.kurentoOptions : null
|
||||
});
|
||||
axios.post(
|
||||
this.ov.host + OpenVidu.API_SESSIONS + '/' + this.sessionId + '/connection',
|
||||
|
@ -390,26 +390,26 @@ export class Session {
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates the properties of a Connection with a [[ConnectionOptions]] object.
|
||||
* Updates the properties of a Connection with a [[ConnectionProperties]] object.
|
||||
* Only these properties can be updated:
|
||||
*
|
||||
* - [[ConnectionOptions.role]]
|
||||
* - [[ConnectionOptions.record]]
|
||||
* - [[ConnectionProperties.role]]
|
||||
* - [[ConnectionProperties.record]]
|
||||
*
|
||||
* This method automatically updates the properties of the local affected objects. This means that there is no need to call
|
||||
* [[Session.fetch]] or [[OpenVidu.fetch]] to see the changes consequence of the execution of this method applied in the local objects.
|
||||
*
|
||||
* @param connectionId The [[Connection.connectionId]] of the Connection object to modify
|
||||
* @param connectionOptions A new [[ConnectionOptions]] object with the updated values to apply
|
||||
* @param connectionProperties A new [[ConnectionProperties]] object with the updated values to apply
|
||||
*
|
||||
* @returns A Promise that is resolved to the updated [[Connection]] object if the operation was
|
||||
* successful and rejected with an Error object if not
|
||||
*/
|
||||
public updateConnection(connectionId: string, connectionOptions: ConnectionOptions): Promise<Connection | undefined> {
|
||||
public updateConnection(connectionId: string, connectionProperties: ConnectionProperties): Promise<Connection | undefined> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
axios.patch(
|
||||
this.ov.host + OpenVidu.API_SESSIONS + "/" + this.sessionId + "/connection/" + connectionId,
|
||||
connectionOptions,
|
||||
connectionProperties,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': this.ov.basicAuth,
|
||||
|
@ -437,7 +437,7 @@ export class Session {
|
|||
resolve(newConnection);
|
||||
} else {
|
||||
// The updated Connection was available in local map
|
||||
existingConnection.overrideConnectionOptions(connectionOptions);
|
||||
existingConnection.overrideConnectionProperties(connectionProperties);
|
||||
this.updateActiveConnectionsArray();
|
||||
resolve(existingConnection);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
import { OpenViduRole } from './OpenViduRole';
|
||||
|
||||
/**
|
||||
* @deprecated Use [[ConnectionOptions]] instead
|
||||
* @deprecated Use [[ConnectionProperties]] instead
|
||||
*/
|
||||
export interface TokenOptions {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ export * from './OpenViduRole';
|
|||
export * from './Session';
|
||||
export * from './SessionProperties';
|
||||
export * from './TokenOptions';
|
||||
export * from './ConnectionOptions';
|
||||
export * from './ConnectionProperties';
|
||||
export * from './ConnectionType';
|
||||
export * from './MediaMode';
|
||||
export * from './RecordingLayout';
|
||||
|
|
|
@ -218,11 +218,20 @@ public class Participant {
|
|||
}
|
||||
|
||||
public String getFullMetadata() {
|
||||
String fullMetadata;
|
||||
if ((!this.clientMetadata.isEmpty()) && (!this.token.getServerMetadata().isEmpty())) {
|
||||
fullMetadata = this.clientMetadata + METADATA_SEPARATOR + this.token.getServerMetadata();
|
||||
String fullMetadata = "";
|
||||
if (this.clientMetadata != null && !this.clientMetadata.isEmpty()) {
|
||||
// Client data defined
|
||||
fullMetadata += this.clientMetadata;
|
||||
}
|
||||
if (this.token.getServerMetadata() != null && !this.token.getServerMetadata().isEmpty()) {
|
||||
// Server data defined
|
||||
if (fullMetadata.isEmpty()) {
|
||||
// Only server data
|
||||
fullMetadata += this.token.getServerMetadata();
|
||||
} else {
|
||||
fullMetadata = this.clientMetadata + this.token.getServerMetadata();
|
||||
// Both client data and server data
|
||||
fullMetadata += METADATA_SEPARATOR + this.token.getServerMetadata();
|
||||
}
|
||||
}
|
||||
return fullMetadata;
|
||||
}
|
||||
|
@ -305,9 +314,9 @@ public class Participant {
|
|||
} else {
|
||||
json.add("token", null);
|
||||
}
|
||||
// Add all ConnectionOptions
|
||||
JsonObject connectionOptionsJson = this.token.getConnectionOptionsWithFinalJsonFormat();
|
||||
connectionOptionsJson.entrySet().forEach(entry -> {
|
||||
// Add all ConnectionProperties
|
||||
JsonObject connectionPropertiesJson = this.token.getConnectionPropertiesWithFinalJsonFormat();
|
||||
connectionPropertiesJson.entrySet().forEach(entry -> {
|
||||
json.add(entry.getKey(), entry.getValue());
|
||||
});
|
||||
json.addProperty("clientData", this.clientMetadata);
|
||||
|
|
|
@ -45,7 +45,7 @@ import com.google.gson.JsonSyntaxException;
|
|||
import io.openvidu.client.OpenViduException;
|
||||
import io.openvidu.client.OpenViduException.Code;
|
||||
import io.openvidu.client.internal.ProtocolElements;
|
||||
import io.openvidu.java.client.ConnectionOptions;
|
||||
import io.openvidu.java.client.ConnectionProperties;
|
||||
import io.openvidu.java.client.ConnectionType;
|
||||
import io.openvidu.java.client.KurentoOptions;
|
||||
import io.openvidu.java.client.OpenViduRole;
|
||||
|
@ -162,7 +162,7 @@ public abstract class SessionManager {
|
|||
String eventType);
|
||||
|
||||
public abstract Participant publishIpcam(Session session, MediaOptions mediaOptions,
|
||||
ConnectionOptions connectionOptions) throws Exception;
|
||||
ConnectionProperties connectionProperties) throws Exception;
|
||||
|
||||
public abstract void reconnectStream(Participant participant, String streamId, String sdpOffer,
|
||||
Integer transactionId);
|
||||
|
@ -314,9 +314,9 @@ public abstract class SessionManager {
|
|||
return tokenObj;
|
||||
}
|
||||
|
||||
public Token newTokenForInsecureUser(Session session, String token, ConnectionOptions connectionOptions)
|
||||
public Token newTokenForInsecureUser(Session session, String token, ConnectionProperties connectionProperties)
|
||||
throws Exception {
|
||||
Token tokenObj = new Token(token, session.getSessionId(), connectionOptions,
|
||||
Token tokenObj = new Token(token, session.getSessionId(), connectionProperties,
|
||||
this.openviduConfig.isTurnadminAvailable() ? this.coturnCredentialsService.createUser() : null);
|
||||
session.storeToken(tokenObj);
|
||||
session.showTokens("Token created for insecure user");
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.commons.lang3.RandomStringUtils;
|
|||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import io.openvidu.java.client.ConnectionOptions;
|
||||
import io.openvidu.java.client.ConnectionProperties;
|
||||
import io.openvidu.java.client.ConnectionType;
|
||||
import io.openvidu.java.client.KurentoOptions;
|
||||
import io.openvidu.java.client.OpenViduRole;
|
||||
|
@ -33,22 +33,22 @@ public class Token {
|
|||
private String token;
|
||||
private String sessionId;
|
||||
private Long createdAt;
|
||||
private ConnectionOptions connectionOptions;
|
||||
private ConnectionProperties connectionProperties;
|
||||
private TurnCredentials turnCredentials;
|
||||
|
||||
private final String connectionId = IdentifierPrefixes.PARTICIPANT_PUBLIC_ID
|
||||
+ RandomStringUtils.randomAlphabetic(1).toUpperCase() + RandomStringUtils.randomAlphanumeric(9);
|
||||
|
||||
public Token(String token, String sessionId, ConnectionOptions connectionOptions, TurnCredentials turnCredentials) {
|
||||
public Token(String token, String sessionId, ConnectionProperties connectionProperties, TurnCredentials turnCredentials) {
|
||||
this.token = token;
|
||||
this.sessionId = sessionId;
|
||||
this.createdAt = System.currentTimeMillis();
|
||||
this.connectionOptions = connectionOptions;
|
||||
this.connectionProperties = connectionProperties;
|
||||
this.turnCredentials = turnCredentials;
|
||||
}
|
||||
|
||||
public ConnectionType getType() {
|
||||
return this.connectionOptions.getType();
|
||||
return this.connectionProperties.getType();
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
|
@ -64,49 +64,49 @@ public class Token {
|
|||
}
|
||||
|
||||
public String getServerMetadata() {
|
||||
return this.connectionOptions.getData();
|
||||
return this.connectionProperties.getData();
|
||||
}
|
||||
|
||||
public boolean record() {
|
||||
return this.connectionOptions.record();
|
||||
return this.connectionProperties.record();
|
||||
}
|
||||
|
||||
public void setRecord(boolean newRecord) {
|
||||
this.updateConnectionOptions(connectionOptions.getType(), connectionOptions.getData(), newRecord,
|
||||
connectionOptions.getRole(), connectionOptions.getKurentoOptions(), connectionOptions.getRtspUri(),
|
||||
connectionOptions.adaptativeBitrate(), connectionOptions.onlyPlayWithSubscribers(),
|
||||
connectionOptions.getNetworkCache());
|
||||
this.updateConnectionProperties(connectionProperties.getType(), connectionProperties.getData(), newRecord,
|
||||
connectionProperties.getRole(), connectionProperties.getKurentoOptions(), connectionProperties.getRtspUri(),
|
||||
connectionProperties.adaptativeBitrate(), connectionProperties.onlyPlayWithSubscribers(),
|
||||
connectionProperties.getNetworkCache());
|
||||
}
|
||||
|
||||
public OpenViduRole getRole() {
|
||||
return this.connectionOptions.getRole();
|
||||
return this.connectionProperties.getRole();
|
||||
}
|
||||
|
||||
public void setRole(OpenViduRole newRole) {
|
||||
this.updateConnectionOptions(connectionOptions.getType(), connectionOptions.getData(),
|
||||
connectionOptions.record(), newRole, connectionOptions.getKurentoOptions(),
|
||||
connectionOptions.getRtspUri(), connectionOptions.adaptativeBitrate(),
|
||||
connectionOptions.onlyPlayWithSubscribers(), connectionOptions.getNetworkCache());
|
||||
this.updateConnectionProperties(connectionProperties.getType(), connectionProperties.getData(),
|
||||
connectionProperties.record(), newRole, connectionProperties.getKurentoOptions(),
|
||||
connectionProperties.getRtspUri(), connectionProperties.adaptativeBitrate(),
|
||||
connectionProperties.onlyPlayWithSubscribers(), connectionProperties.getNetworkCache());
|
||||
}
|
||||
|
||||
public KurentoOptions getKurentoOptions() {
|
||||
return this.connectionOptions.getKurentoOptions();
|
||||
return this.connectionProperties.getKurentoOptions();
|
||||
}
|
||||
|
||||
public String getRtspUri() {
|
||||
return this.connectionOptions.getRtspUri();
|
||||
return this.connectionProperties.getRtspUri();
|
||||
}
|
||||
|
||||
public Boolean adaptativeBitrate() {
|
||||
return this.connectionOptions.adaptativeBitrate();
|
||||
return this.connectionProperties.adaptativeBitrate();
|
||||
}
|
||||
|
||||
public Boolean onlyPlayWithSubscribers() {
|
||||
return this.connectionOptions.onlyPlayWithSubscribers();
|
||||
return this.connectionProperties.onlyPlayWithSubscribers();
|
||||
}
|
||||
|
||||
public Integer getNetworkCache() {
|
||||
return this.connectionOptions.getNetworkCache();
|
||||
return this.connectionProperties.getNetworkCache();
|
||||
}
|
||||
|
||||
public TurnCredentials getTurnCredentials() {
|
||||
|
@ -141,9 +141,9 @@ public class Token {
|
|||
json.addProperty("sessionId", this.sessionId);
|
||||
json.addProperty("createdAt", this.createdAt);
|
||||
|
||||
// Add all ConnectionOptions
|
||||
JsonObject connectionOptionsJson = this.getConnectionOptionsWithFinalJsonFormat();
|
||||
connectionOptionsJson.entrySet().forEach(entry -> {
|
||||
// Add all ConnectionProperties
|
||||
JsonObject connectionPropertiesJson = this.getConnectionPropertiesWithFinalJsonFormat();
|
||||
connectionPropertiesJson.entrySet().forEach(entry -> {
|
||||
json.add(entry.getKey(), entry.getValue());
|
||||
});
|
||||
|
||||
|
@ -157,18 +157,18 @@ public class Token {
|
|||
return json;
|
||||
}
|
||||
|
||||
protected JsonObject getConnectionOptionsWithFinalJsonFormat() {
|
||||
JsonObject json = this.connectionOptions.toJson(this.sessionId);
|
||||
protected JsonObject getConnectionPropertiesWithFinalJsonFormat() {
|
||||
JsonObject json = this.connectionProperties.toJson(this.sessionId);
|
||||
json.remove("session");
|
||||
json.addProperty("serverData", json.get("data").getAsString());
|
||||
json.remove("data");
|
||||
return json;
|
||||
}
|
||||
|
||||
private void updateConnectionOptions(ConnectionType type, String data, Boolean record, OpenViduRole role,
|
||||
private void updateConnectionProperties(ConnectionType type, String data, Boolean record, OpenViduRole role,
|
||||
KurentoOptions kurentoOptions, String rtspUri, Boolean adaptativeBitrate, Boolean onlyPlayWithSubscribers,
|
||||
Integer networkCache) {
|
||||
ConnectionOptions.Builder builder = new ConnectionOptions.Builder();
|
||||
ConnectionProperties.Builder builder = new ConnectionProperties.Builder();
|
||||
if (type != null) {
|
||||
builder.type(type);
|
||||
}
|
||||
|
@ -196,13 +196,13 @@ public class Token {
|
|||
if (networkCache != null) {
|
||||
builder.networkCache(networkCache);
|
||||
}
|
||||
this.connectionOptions = builder.build();
|
||||
this.connectionProperties = builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.connectionOptions.getRole() != null)
|
||||
return this.connectionOptions.getRole().name();
|
||||
if (this.connectionProperties.getRole() != null)
|
||||
return this.connectionProperties.getRole().name();
|
||||
else
|
||||
return this.token;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package io.openvidu.server.core;
|
|||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import io.openvidu.java.client.ConnectionOptions;
|
||||
import io.openvidu.java.client.ConnectionProperties;
|
||||
import io.openvidu.java.client.ConnectionType;
|
||||
import io.openvidu.java.client.KurentoOptions;
|
||||
import io.openvidu.java.client.OpenViduRole;
|
||||
|
@ -58,8 +58,8 @@ public class TokenGenerator {
|
|||
token += "&turnCredential=" + turnCredentials.getCredential();
|
||||
}
|
||||
}
|
||||
ConnectionOptions connectionOptions = new ConnectionOptions.Builder().type(ConnectionType.WEBRTC)
|
||||
ConnectionProperties connectionProperties = new ConnectionProperties.Builder().type(ConnectionType.WEBRTC)
|
||||
.data(serverMetadata).record(record).role(role).kurentoOptions(kurentoOptions).build();
|
||||
return new Token(token, sessionId, connectionOptions, turnCredentials);
|
||||
return new Token(token, sessionId, connectionProperties, turnCredentials);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ import com.google.gson.JsonObject;
|
|||
import io.openvidu.client.OpenViduException;
|
||||
import io.openvidu.client.OpenViduException.Code;
|
||||
import io.openvidu.client.internal.ProtocolElements;
|
||||
import io.openvidu.java.client.ConnectionOptions;
|
||||
import io.openvidu.java.client.ConnectionProperties;
|
||||
import io.openvidu.java.client.KurentoOptions;
|
||||
import io.openvidu.java.client.MediaMode;
|
||||
import io.openvidu.java.client.Recording;
|
||||
|
@ -992,7 +992,7 @@ public class KurentoSessionManager extends SessionManager {
|
|||
|
||||
@Override
|
||||
/* Protected by Session.closingLock.readLock */
|
||||
public Participant publishIpcam(Session session, MediaOptions mediaOptions, ConnectionOptions connectionOptions)
|
||||
public Participant publishIpcam(Session session, MediaOptions mediaOptions, ConnectionProperties connectionProperties)
|
||||
throws Exception {
|
||||
final String sessionId = session.getSessionId();
|
||||
final KurentoMediaOptions kMediaOptions = (KurentoMediaOptions) mediaOptions;
|
||||
|
@ -1035,7 +1035,7 @@ public class KurentoSessionManager extends SessionManager {
|
|||
String token = IdentifierPrefixes.TOKEN_ID + RandomStringUtils.randomAlphabetic(1).toUpperCase()
|
||||
+ RandomStringUtils.randomAlphanumeric(15);
|
||||
|
||||
this.newTokenForInsecureUser(session, token, connectionOptions);
|
||||
this.newTokenForInsecureUser(session, token, connectionProperties);
|
||||
final Token tokenObj = session.consumeToken(token);
|
||||
|
||||
Participant ipcamParticipant = this.newIpcamParticipant(sessionId, rtspConnectionId, tokenObj, location,
|
||||
|
|
|
@ -50,7 +50,7 @@ import com.google.gson.JsonParser;
|
|||
|
||||
import io.openvidu.client.OpenViduException;
|
||||
import io.openvidu.client.internal.ProtocolElements;
|
||||
import io.openvidu.java.client.ConnectionOptions;
|
||||
import io.openvidu.java.client.ConnectionProperties;
|
||||
import io.openvidu.java.client.ConnectionType;
|
||||
import io.openvidu.java.client.KurentoOptions;
|
||||
import io.openvidu.java.client.MediaMode;
|
||||
|
@ -282,18 +282,18 @@ public class SessionRestController {
|
|||
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
ConnectionOptions connectionOptions;
|
||||
ConnectionProperties connectionProperties;
|
||||
try {
|
||||
connectionOptions = getConnectionOptionsFromParams(params);
|
||||
connectionProperties = getConnectionPropertiesFromParams(params);
|
||||
} catch (Exception e) {
|
||||
return this.generateErrorResponse(e.getMessage(), "/sessions/" + sessionId + "/connection",
|
||||
HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
switch (connectionOptions.getType()) {
|
||||
switch (connectionProperties.getType()) {
|
||||
case WEBRTC:
|
||||
return this.newWebrtcConnection(session, connectionOptions);
|
||||
return this.newWebrtcConnection(session, connectionProperties);
|
||||
case IPCAM:
|
||||
return this.newIpcamConnection(session, connectionOptions);
|
||||
return this.newIpcamConnection(session, connectionProperties);
|
||||
default:
|
||||
return this.generateErrorResponse("Wrong type parameter", "/sessions/" + sessionId + "/connection",
|
||||
HttpStatus.BAD_REQUEST);
|
||||
|
@ -657,14 +657,15 @@ public class SessionRestController {
|
|||
return this.generateErrorResponse("Session " + sessionId + " not found", "/tokens", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
ConnectionOptions connectionOptions;
|
||||
ConnectionProperties connectionProperties;
|
||||
params.remove("record");
|
||||
try {
|
||||
connectionOptions = getConnectionOptionsFromParams(params);
|
||||
connectionProperties = getConnectionPropertiesFromParams(params);
|
||||
} catch (Exception e) {
|
||||
return this.generateErrorResponse(e.getMessage(), "/sessions/" + sessionId + "/connection",
|
||||
HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
ResponseEntity<?> entity = this.newWebrtcConnection(session, connectionOptions);
|
||||
ResponseEntity<?> entity = this.newWebrtcConnection(session, connectionProperties);
|
||||
JsonObject jsonResponse = JsonParser.parseString(entity.getBody().toString()).getAsJsonObject();
|
||||
|
||||
if (jsonResponse.has("error")) {
|
||||
|
@ -779,15 +780,15 @@ public class SessionRestController {
|
|||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
protected ResponseEntity<?> newWebrtcConnection(Session session, ConnectionOptions connectionOptions) {
|
||||
protected ResponseEntity<?> newWebrtcConnection(Session session, ConnectionProperties connectionProperties) {
|
||||
|
||||
final String REQUEST_PATH = "/sessions/" + session.getSessionId() + "/connection";
|
||||
|
||||
// While closing a session tokens can't be generated
|
||||
if (session.closingLock.readLock().tryLock()) {
|
||||
try {
|
||||
Token token = sessionManager.newToken(session, connectionOptions.getRole(), connectionOptions.getData(),
|
||||
connectionOptions.record(), connectionOptions.getKurentoOptions());
|
||||
Token token = sessionManager.newToken(session, connectionProperties.getRole(), connectionProperties.getData(),
|
||||
connectionProperties.record(), connectionProperties.getKurentoOptions());
|
||||
return new ResponseEntity<>(token.toJsonAsParticipant().toString(), RestUtils.getResponseHeaders(),
|
||||
HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
|
@ -805,7 +806,7 @@ public class SessionRestController {
|
|||
}
|
||||
}
|
||||
|
||||
protected ResponseEntity<?> newIpcamConnection(Session session, ConnectionOptions connectionOptions) {
|
||||
protected ResponseEntity<?> newIpcamConnection(Session session, ConnectionProperties connectionProperties) {
|
||||
|
||||
final String REQUEST_PATH = "/sessions/" + session.getSessionId() + "/connection";
|
||||
|
||||
|
@ -817,9 +818,9 @@ public class SessionRestController {
|
|||
Integer frameRate = null;
|
||||
String videoDimensions = null;
|
||||
KurentoMediaOptions mediaOptions = new KurentoMediaOptions(true, null, hasAudio, hasVideo, audioActive,
|
||||
videoActive, typeOfVideo, frameRate, videoDimensions, null, false, connectionOptions.getRtspUri(),
|
||||
connectionOptions.adaptativeBitrate(), connectionOptions.onlyPlayWithSubscribers(),
|
||||
connectionOptions.getNetworkCache());
|
||||
videoActive, typeOfVideo, frameRate, videoDimensions, null, false, connectionProperties.getRtspUri(),
|
||||
connectionProperties.adaptativeBitrate(), connectionProperties.onlyPlayWithSubscribers(),
|
||||
connectionProperties.getNetworkCache());
|
||||
|
||||
// While closing a session IP cameras can't be published
|
||||
if (session.closingLock.readLock().tryLock()) {
|
||||
|
@ -828,7 +829,7 @@ public class SessionRestController {
|
|||
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Participant ipcamParticipant = this.sessionManager.publishIpcam(session, mediaOptions,
|
||||
connectionOptions);
|
||||
connectionProperties);
|
||||
return new ResponseEntity<>(ipcamParticipant.toJson().toString(), RestUtils.getResponseHeaders(),
|
||||
HttpStatus.OK);
|
||||
} catch (MalformedURLException e) {
|
||||
|
@ -857,9 +858,9 @@ public class SessionRestController {
|
|||
return token;
|
||||
}
|
||||
|
||||
protected ConnectionOptions getConnectionOptionsFromParams(Map<?, ?> params) throws Exception {
|
||||
protected ConnectionProperties getConnectionPropertiesFromParams(Map<?, ?> params) throws Exception {
|
||||
|
||||
ConnectionOptions.Builder builder = new ConnectionOptions.Builder();
|
||||
ConnectionProperties.Builder builder = new ConnectionProperties.Builder();
|
||||
|
||||
String typeString;
|
||||
String data;
|
||||
|
|
|
@ -45,7 +45,7 @@ import com.google.gson.JsonSyntaxException;
|
|||
import io.openvidu.client.OpenViduException;
|
||||
import io.openvidu.client.OpenViduException.Code;
|
||||
import io.openvidu.client.internal.ProtocolElements;
|
||||
import io.openvidu.java.client.ConnectionOptions;
|
||||
import io.openvidu.java.client.ConnectionProperties;
|
||||
import io.openvidu.server.config.OpenviduConfig;
|
||||
import io.openvidu.server.core.EndReason;
|
||||
import io.openvidu.server.core.IdentifierPrefixes;
|
||||
|
@ -249,7 +249,7 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
|
|||
token = IdentifierPrefixes.TOKEN_ID + RandomStringUtils.randomAlphabetic(1).toUpperCase()
|
||||
+ RandomStringUtils.randomAlphanumeric(15);
|
||||
try {
|
||||
sessionManager.newTokenForInsecureUser(session, token, new ConnectionOptions.Builder().build());
|
||||
sessionManager.newTokenForInsecureUser(session, token, new ConnectionProperties.Builder().build());
|
||||
} catch (Exception e) {
|
||||
throw new OpenViduException(Code.TOKEN_CANNOT_BE_CREATED_ERROR_CODE,
|
||||
"Unable to create token for session " + sessionId + ": " + e.getMessage());
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import io.openvidu.java.client.ConnectionOptions;
|
||||
import io.openvidu.java.client.ConnectionProperties;
|
||||
import io.openvidu.server.core.Participant;
|
||||
import io.openvidu.server.core.SessionManager;
|
||||
import io.openvidu.server.core.Token;
|
||||
|
@ -115,8 +115,8 @@ public class SessionGarbageCollectorIntegrationTest {
|
|||
}
|
||||
|
||||
private void joinParticipant(String sessionId, String token) {
|
||||
ConnectionOptions connectionOptions = new ConnectionOptions.Builder().data("SERVER_METADATA").build();
|
||||
Token t = new Token(token, sessionId, connectionOptions, null);
|
||||
ConnectionProperties connectionProperties = new ConnectionProperties.Builder().data("SERVER_METADATA").build();
|
||||
Token t = new Token(token, sessionId, connectionProperties, null);
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
String participantPrivateId = "PARTICIPANT_PRIVATE_ID_" + uuid;
|
||||
String finalUserId = "FINAL_USER_ID_" + uuid;
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.google.gson.stream.JsonReader;
|
|||
import com.mashape.unirest.http.HttpMethod;
|
||||
|
||||
import io.openvidu.java.client.Connection;
|
||||
import io.openvidu.java.client.ConnectionOptions;
|
||||
import io.openvidu.java.client.ConnectionProperties;
|
||||
import io.openvidu.java.client.OpenVidu;
|
||||
import io.openvidu.java.client.OpenViduHttpException;
|
||||
import io.openvidu.java.client.OpenViduRole;
|
||||
|
@ -230,14 +230,14 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
Assert.assertTrue("OpenVidu object should have changed", OV.fetch());
|
||||
Session session = OV.getActiveSessions().get(0);
|
||||
try {
|
||||
session.updateConnection("WRONG_CONNECTION_ID", new ConnectionOptions.Builder().build());
|
||||
session.updateConnection("WRONG_CONNECTION_ID", new ConnectionProperties.Builder().build());
|
||||
Assert.fail("Expected OpenViduHttpException exception");
|
||||
} catch (OpenViduHttpException exception) {
|
||||
Assert.assertEquals("Wrong HTTP status", HttpStatus.SC_NOT_FOUND, exception.getStatus());
|
||||
}
|
||||
Assert.assertFalse("Session object should not have changed", session.fetch());
|
||||
Connection connection = session.updateConnection(tokenConnectionId,
|
||||
new ConnectionOptions.Builder().role(OpenViduRole.SUBSCRIBER).record(false).build());
|
||||
new ConnectionProperties.Builder().role(OpenViduRole.SUBSCRIBER).record(false).build());
|
||||
Assert.assertEquals("Wrong role Connection property", OpenViduRole.SUBSCRIBER, connection.getRole());
|
||||
Assert.assertFalse("Wrong record Connection property", connection.record());
|
||||
|
||||
|
@ -339,25 +339,25 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
// Test with openvidu-java-client
|
||||
Assert.assertFalse("Session object should not have changed", session.fetch());
|
||||
try {
|
||||
session.updateConnection("WRONG_CONNECTION_ID", new ConnectionOptions.Builder().build());
|
||||
session.updateConnection("WRONG_CONNECTION_ID", new ConnectionProperties.Builder().build());
|
||||
Assert.fail("Expected OpenViduHttpException exception");
|
||||
} catch (OpenViduHttpException exception) {
|
||||
Assert.assertEquals("Wrong HTTP status", HttpStatus.SC_NOT_FOUND, exception.getStatus());
|
||||
}
|
||||
Assert.assertFalse("Session object should not have changed", session.fetch());
|
||||
connection = session.updateConnection(tokenConnectionId,
|
||||
new ConnectionOptions.Builder().role(OpenViduRole.PUBLISHER).build());
|
||||
new ConnectionProperties.Builder().role(OpenViduRole.PUBLISHER).build());
|
||||
Assert.assertFalse("Session object should not have changed", session.fetch());
|
||||
Assert.assertEquals("Wrong connectionId in Connection object", tokenConnectionId, connection.getConnectionId());
|
||||
Assert.assertEquals("Wrong role in Connection object", OpenViduRole.PUBLISHER, connection.getRole());
|
||||
Assert.assertFalse("Wrong record in Connection object", connection.record());
|
||||
Assert.assertEquals("Wrong status in Connection object", "active", connection.getStatus());
|
||||
connection = session.updateConnection(tokenConnectionId,
|
||||
new ConnectionOptions.Builder().role(OpenViduRole.SUBSCRIBER).build());
|
||||
new ConnectionProperties.Builder().role(OpenViduRole.SUBSCRIBER).build());
|
||||
Assert.assertEquals("Wrong role in Connection object", OpenViduRole.SUBSCRIBER, connection.getRole());
|
||||
Assert.assertFalse("Session object should not have changed", session.fetch());
|
||||
connection = session.updateConnection(tokenConnectionId,
|
||||
new ConnectionOptions.Builder().role(OpenViduRole.MODERATOR).record(false).data("NO CHANGE").build());
|
||||
new ConnectionProperties.Builder().role(OpenViduRole.MODERATOR).record(false).data("NO CHANGE").build());
|
||||
Assert.assertFalse("Session object should not have changed", session.fetch());
|
||||
Assert.assertEquals("Wrong role in Connection object", OpenViduRole.MODERATOR, connection.getRole());
|
||||
Assert.assertFalse("Wrong record in Connection object", connection.record());
|
||||
|
@ -411,7 +411,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
Assert.assertEquals("Wrong role property", OpenViduRole.PUBLISHER, connection.getRole());
|
||||
Assert.assertTrue("Wrong record property", connection.record());
|
||||
session.updateConnection(connection.getConnectionId(),
|
||||
new ConnectionOptions.Builder().role(OpenViduRole.SUBSCRIBER).record(false).build());
|
||||
new ConnectionProperties.Builder().role(OpenViduRole.SUBSCRIBER).record(false).build());
|
||||
Assert.assertEquals("Wrong role property", OpenViduRole.SUBSCRIBER, connection.getRole());
|
||||
Assert.assertFalse("Wrong record property", connection.record());
|
||||
Assert.assertFalse(session.fetch());
|
||||
|
|
|
@ -54,7 +54,7 @@ import com.google.gson.JsonParser;
|
|||
import com.mashape.unirest.http.HttpMethod;
|
||||
|
||||
import io.openvidu.java.client.Connection;
|
||||
import io.openvidu.java.client.ConnectionOptions;
|
||||
import io.openvidu.java.client.ConnectionProperties;
|
||||
import io.openvidu.java.client.ConnectionType;
|
||||
import io.openvidu.java.client.KurentoOptions;
|
||||
import io.openvidu.java.client.MediaMode;
|
||||
|
@ -2138,13 +2138,13 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
|
||||
KurentoOptions kurentoOptions = new KurentoOptions.Builder().videoMaxRecvBandwidth(250)
|
||||
.allowedFilters(new String[] { "GStreamerFilter" }).build();
|
||||
ConnectionOptions moderatorConnectionOptions = new ConnectionOptions.Builder().role(OpenViduRole.MODERATOR)
|
||||
ConnectionProperties moderatorConnectionProperties = new ConnectionProperties.Builder().role(OpenViduRole.MODERATOR)
|
||||
.data(serverDataModerator).kurentoOptions(kurentoOptions).build();
|
||||
Connection connectionModerator = session.createConnection(moderatorConnectionOptions);
|
||||
Connection connectionModerator = session.createConnection(moderatorConnectionProperties);
|
||||
|
||||
ConnectionOptions subscriberConnectionOptions = new ConnectionOptions.Builder().type(ConnectionType.WEBRTC)
|
||||
ConnectionProperties subscriberConnectionProperties = new ConnectionProperties.Builder().type(ConnectionType.WEBRTC)
|
||||
.role(OpenViduRole.SUBSCRIBER).data(serverDataSubscriber).build();
|
||||
Connection connectionSubscriber = session.createConnection(subscriberConnectionOptions);
|
||||
Connection connectionSubscriber = session.createConnection(subscriberConnectionProperties);
|
||||
|
||||
Assert.assertFalse("Session.fetch() should return false after Session.createConnection", session.fetch());
|
||||
Assert.assertFalse("OpenVidu.fetch() should return false after Session.fetch()", OV.fetch());
|
||||
|
@ -2543,7 +2543,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
|
||||
// Test IPCAM
|
||||
final String rtsp = "rtsp://dummyurl.com";
|
||||
Connection ipcamera = session.createConnection(new ConnectionOptions.Builder().type(ConnectionType.IPCAM)
|
||||
Connection ipcamera = session.createConnection(new ConnectionProperties.Builder().type(ConnectionType.IPCAM)
|
||||
.rtspUri(rtsp).adaptativeBitrate(false).onlyPlayWithSubscribers(false).networkCache(50).build());
|
||||
Assert.assertFalse("OpenVidu.fetch() should return false", OV.fetch());
|
||||
Assert.assertFalse("Session.fetch() should return false", session.fetch());
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
<input matInput id="stream-id-field" placeholder="streamId" [(ngModel)]="streamId">
|
||||
</mat-form-field>
|
||||
<div style="margin-left:9px">
|
||||
<mat-checkbox class="checkbox-form" [(ngModel)]="connectionOptions.record" id="record-checkbox">Record
|
||||
<mat-checkbox class="checkbox-form" [(ngModel)]="connectionProperties.record" id="record-checkbox">Record
|
||||
</mat-checkbox>
|
||||
<mat-form-field class="inner-text-input" [style.fontSize.px]=14>
|
||||
<mat-select [(ngModel)]="connectionOptions.role" id="token-role-select">
|
||||
<mat-select [(ngModel)]="connectionProperties.role" id="token-role-select">
|
||||
<mat-option *ngFor="let enumerator of enumToArray(openviduRoles)" [value]="enumerator">
|
||||
<span [attr.id]="'option-' + enumerator">{{ enumerator }}</span>
|
||||
</mat-option>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||
|
||||
import { OpenVidu as OpenViduAPI, Session as SessionAPI, Recording, RecordingProperties, RecordingLayout, ConnectionOptions, OpenViduRole } from 'openvidu-node-client';
|
||||
import { OpenVidu as OpenViduAPI, Session as SessionAPI, Recording, RecordingProperties, RecordingLayout, ConnectionProperties, OpenViduRole } from 'openvidu-node-client';
|
||||
|
||||
@Component({
|
||||
selector: 'app-session-api-dialog',
|
||||
|
@ -26,7 +26,7 @@ export class SessionApiDialogComponent {
|
|||
recPropertiesIcon = 'add_circle';
|
||||
showRecProperties = false;
|
||||
|
||||
connectionOptions: ConnectionOptions = {
|
||||
connectionProperties: ConnectionProperties = {
|
||||
record: true,
|
||||
role: OpenViduRole.PUBLISHER
|
||||
};
|
||||
|
@ -174,7 +174,7 @@ export class SessionApiDialogComponent {
|
|||
|
||||
createConnection() {
|
||||
console.log('Creating connection');
|
||||
this.session.createConnection(this.connectionOptions)
|
||||
this.session.createConnection(this.connectionProperties)
|
||||
.then(connection => {
|
||||
this.response = 'Connection created: ' + connection.connectionId;
|
||||
})
|
||||
|
@ -185,9 +185,9 @@ export class SessionApiDialogComponent {
|
|||
|
||||
updateConnection() {
|
||||
console.log('Updating connection');
|
||||
this.session.updateConnection(this.connectionId, this.connectionOptions)
|
||||
this.session.updateConnection(this.connectionId, this.connectionProperties)
|
||||
.then(modifiedConnection => {
|
||||
this.response = 'Connection updated: ' + JSON.stringify({ role: modifiedConnection.connectionOptions.role, record: modifiedConnection.connectionOptions.record });
|
||||
this.response = 'Connection updated: ' + JSON.stringify({ role: modifiedConnection.connectionProperties.role, record: modifiedConnection.connectionProperties.record });
|
||||
})
|
||||
.catch(error => {
|
||||
this.response = 'Error [' + error.message + ']';
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<mat-dialog-content>
|
||||
<label class="label">Role</label>
|
||||
<div id="role-div">
|
||||
<mat-radio-group name="Role" [(ngModel)]="connectionOptions.role">
|
||||
<mat-radio-group name="Role" [(ngModel)]="connectionProperties.role">
|
||||
<mat-radio-button id="radio-btn-sub" value="SUBSCRIBER">SUB</mat-radio-button>
|
||||
<mat-radio-button id="radio-btn-pub" value="PUBLISHER">PUB</mat-radio-button>
|
||||
<mat-radio-button id="radio-btn-mod" value="MODERATOR">MOD</mat-radio-button>
|
||||
|
@ -79,19 +79,19 @@
|
|||
<div id="kurento-config-div">
|
||||
<mat-form-field style="width: 39%; margin-right: 5px">
|
||||
<input matInput placeholder="Max recv" type="number"
|
||||
[(ngModel)]="connectionOptions.kurentoOptions.videoMaxRecvBandwidth">
|
||||
[(ngModel)]="connectionProperties.kurentoOptions.videoMaxRecvBandwidth">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 39%">
|
||||
<input matInput placeholder="Min recv" type="number"
|
||||
[(ngModel)]="connectionOptions.kurentoOptions.videoMinRecvBandwidth">
|
||||
[(ngModel)]="connectionProperties.kurentoOptions.videoMinRecvBandwidth">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 39%; margin-right: 5px">
|
||||
<input matInput placeholder="Max send" type="number"
|
||||
[(ngModel)]="connectionOptions.kurentoOptions.videoMaxSendBandwidth">
|
||||
[(ngModel)]="connectionProperties.kurentoOptions.videoMaxSendBandwidth">
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 39%">
|
||||
<input matInput placeholder="Min send" type="number"
|
||||
[(ngModel)]="connectionOptions.kurentoOptions.videoMinSendBandwidth">
|
||||
[(ngModel)]="connectionProperties.kurentoOptions.videoMinSendBandwidth">
|
||||
</mat-form-field>
|
||||
<mat-chip-list *ngIf="filters.length > 0">
|
||||
<mat-chip style="height: 20px" *ngFor="let filterName of filters"
|
||||
|
@ -108,7 +108,7 @@
|
|||
</div>
|
||||
|
||||
<div id="record-div">
|
||||
<mat-checkbox class="checkbox-form" [(ngModel)]="connectionOptions.record" id="record-checkbox">Record
|
||||
<mat-checkbox class="checkbox-form" [(ngModel)]="connectionProperties.record" id="record-checkbox">Record
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
|
||||
|
@ -132,6 +132,6 @@
|
|||
<mat-dialog-actions>
|
||||
<button id="cancel-btn" mat-button [mat-dialog-close]="undefined">CANCEL</button>
|
||||
<button id="save-btn" mat-button
|
||||
[mat-dialog-close]="{sessionProperties: sessionProperties, turnConf: turnConf, manualTurnConf: manualTurnConf, customToken: customToken, forcePublishing: forcePublishing, connectionOptions: generateConnectionOptions()}">SAVE</button>
|
||||
[mat-dialog-close]="{sessionProperties: sessionProperties, turnConf: turnConf, manualTurnConf: manualTurnConf, customToken: customToken, forcePublishing: forcePublishing, connectionProperties: generateConnectionProperties()}">SAVE</button>
|
||||
</mat-dialog-actions>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||
|
||||
import { SessionProperties, MediaMode, Recording, RecordingMode, RecordingLayout, ConnectionOptions } from 'openvidu-node-client';
|
||||
import { SessionProperties, MediaMode, Recording, RecordingMode, RecordingLayout, ConnectionProperties } from 'openvidu-node-client';
|
||||
|
||||
@Component({
|
||||
selector: 'app-session-properties-dialog',
|
||||
|
@ -15,7 +15,7 @@ export class SessionPropertiesDialogComponent {
|
|||
manualTurnConf: RTCIceServer = { urls: [] };
|
||||
customToken: string;
|
||||
forcePublishing: boolean = false;
|
||||
connectionOptions: ConnectionOptions;
|
||||
connectionProperties: ConnectionProperties;
|
||||
|
||||
filterName = 'GStreamerFilter';
|
||||
filters: string[] = [];
|
||||
|
@ -32,16 +32,16 @@ export class SessionPropertiesDialogComponent {
|
|||
this.manualTurnConf = data.manualTurnConf;
|
||||
this.customToken = data.customToken;
|
||||
this.forcePublishing = data.forcePublishing;
|
||||
this.connectionOptions = data.connectionOptions;
|
||||
this.connectionProperties = data.connectionProperties;
|
||||
}
|
||||
|
||||
enumToArray(enumerator: any) {
|
||||
return Object.keys(enumerator);
|
||||
}
|
||||
|
||||
generateConnectionOptions(): ConnectionOptions {
|
||||
this.connectionOptions.kurentoOptions.allowedFilters = this.filters;
|
||||
return this.connectionOptions;
|
||||
generateConnectionProperties(): ConnectionProperties {
|
||||
this.connectionProperties.kurentoOptions.allowedFilters = this.filters;
|
||||
return this.connectionProperties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
RecordingMode,
|
||||
RecordingLayout,
|
||||
Connection,
|
||||
ConnectionOptions,
|
||||
ConnectionProperties,
|
||||
OpenViduRole,
|
||||
RecordingProperties,
|
||||
Recording,
|
||||
|
@ -129,7 +129,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
manualTurnConf: RTCIceServer = { urls: [] };
|
||||
customToken: string;
|
||||
forcePublishing: boolean;
|
||||
connectionOptions: ConnectionOptions = {
|
||||
connectionProperties: ConnectionProperties = {
|
||||
role: OpenViduRole.PUBLISHER,
|
||||
record: true,
|
||||
kurentoOptions: {
|
||||
|
@ -566,7 +566,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
manualTurnConf: this.manualTurnConf,
|
||||
customToken: this.customToken,
|
||||
forcePublishing: this.forcePublishing,
|
||||
connectionOptions: this.connectionOptions,
|
||||
connectionProperties: this.connectionProperties,
|
||||
},
|
||||
width: '450px'
|
||||
});
|
||||
|
@ -581,7 +581,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
this.manualTurnConf = result.manualTurnConf;
|
||||
this.customToken = result.customToken;
|
||||
this.forcePublishing = result.forcePublishing;
|
||||
this.connectionOptions = result.connectionOptions;
|
||||
this.connectionProperties = result.connectionProperties;
|
||||
}
|
||||
document.getElementById('session-settings-btn-' + this.index).classList.remove('cdk-program-focused');
|
||||
});
|
||||
|
@ -693,7 +693,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
}
|
||||
|
||||
async createConnection(): Promise<Connection> {
|
||||
return this.sessionAPI.createConnection(this.connectionOptions);
|
||||
return this.sessionAPI.createConnection(this.connectionProperties);
|
||||
}
|
||||
|
||||
updateEventFromChild(event: OpenViduEvent) {
|
||||
|
|
Loading…
Reference in New Issue