diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/KurentoOptions.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/KurentoOptions.java
new file mode 100644
index 00000000..93b105d7
--- /dev/null
+++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/KurentoOptions.java
@@ -0,0 +1,174 @@
+/*
+ * (C) Copyright 2017-2018 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.java.client;
+
+/**
+ * See {@link io.openvidu.java.client.TokenOptions#getKurentoOptions()}
+ */
+public class KurentoOptions {
+
+ private Integer videoMaxRecvBandwidth;
+ private Integer videoMinRecvBandwidth;
+ private Integer videoMaxSendBandwidth;
+ private Integer videoMinSendBandwidth;
+ private String[] allowedFilters;
+
+ /**
+ *
+ * Builder for {@link io.openvidu.java.client.KurentoOptions}
+ *
+ */
+ public static class Builder {
+
+ private Integer videoMaxRecvBandwidth;
+ private Integer videoMinRecvBandwidth;
+ private Integer videoMaxSendBandwidth;
+ private Integer videoMinSendBandwidth;
+ private String[] allowedFilters = {};
+
+ /**
+ * Builder for {@link io.openvidu.java.client.KurentoOptions}
+ */
+ public KurentoOptions build() {
+ return new KurentoOptions(this.videoMaxRecvBandwidth, this.videoMinRecvBandwidth,
+ this.videoMaxSendBandwidth, this.videoMinSendBandwidth, this.allowedFilters);
+ }
+
+ /**
+ * Set value for
+ * {@link io.openvidu.java.client.KurentoOptions#getVideoMaxRecvBandwidth()}
+ */
+ public Builder videoMaxRecvBandwidth(int videoMaxRecvBandwidth) {
+ this.videoMaxRecvBandwidth = videoMaxRecvBandwidth;
+ return this;
+ }
+
+ /**
+ * Set value for
+ * {@link io.openvidu.java.client.KurentoOptions#getVideoMinRecvBandwidth()}
+ */
+ public Builder videoMinRecvBandwidth(int videoMinRecvBandwidth) {
+ this.videoMinRecvBandwidth = videoMinRecvBandwidth;
+ return this;
+ }
+
+ /**
+ * Set value for
+ * {@link io.openvidu.java.client.KurentoOptions#getVideoMaxSendBandwidth()}
+ */
+ public Builder videoMaxSendBandwidth(int videoMaxSendBandwidth) {
+ this.videoMaxSendBandwidth = videoMaxSendBandwidth;
+ return this;
+ }
+
+ /**
+ * Set value for
+ * {@link io.openvidu.java.client.KurentoOptions#getVideoMinSendBandwidth()}
+ */
+ public Builder videoMinSendBandwidth(int videoMinSendBandwidth) {
+ this.videoMinSendBandwidth = videoMinSendBandwidth;
+ return this;
+ }
+
+ /**
+ * Set value for
+ * {@link io.openvidu.java.client.KurentoOptions#getAllowedFilters()}
+ */
+ public Builder allowedFilters(String[] allowedFilters) {
+ this.allowedFilters = allowedFilters;
+ return this;
+ }
+ }
+
+ public KurentoOptions(Integer videoMaxRecvBandwidth, Integer videoMinRecvBandwidth, Integer videoMaxSendBandwidth,
+ Integer videoMinSendBandwidth, String[] allowedFilters) {
+ this.videoMaxRecvBandwidth = videoMaxRecvBandwidth;
+ this.videoMinRecvBandwidth = videoMinRecvBandwidth;
+ this.videoMaxSendBandwidth = videoMaxSendBandwidth;
+ this.videoMinSendBandwidth = videoMinSendBandwidth;
+ this.allowedFilters = allowedFilters;
+ }
+
+ /**
+ * Defines the maximum number of Kbps that the client owning the token will be
+ * able to receive from Kurento Media Server. 0 means unconstrained. Giving a
+ * value to this property will override the global configuration set in OpenVidu Server configuration (parameter
+ * openvidu.streams.video.max-recv-bandwidth
) for every incoming
+ * stream of the user owning the token.
+ * WARNING: the lower value set to this property limits every
+ * other bandwidth of the WebRTC pipeline this server-to-client stream belongs
+ * to. This includes the user publishing the stream and every other user
+ * subscribed to the stream
+ */
+ public Integer getVideoMaxRecvBandwidth() {
+ return videoMaxRecvBandwidth;
+ }
+
+ /**
+ * Defines the minimum number of Kbps that the client owning the token will try
+ * to receive from Kurento Media Server. 0 means unconstrained. Giving a value
+ * to this property will override the global configuration set in OpenVidu Server configuration (parameter
+ * openvidu.streams.video.min-recv-bandwidth
) for every incoming
+ * stream of the user owning the token.
+ */
+ public Integer getVideoMinRecvBandwidth() {
+ return videoMinRecvBandwidth;
+ }
+
+ /**
+ * Defines the maximum number of Kbps that the client owning the token will be
+ * able to send to Kurento Media Server. 0 means unconstrained. Giving a value
+ * to this property will override the global configuration set in OpenVidu Server configuration (parameter
+ * openvidu.streams.video.max-send-bandwidth
) for every outgoing
+ * stream of the user owning the token.
+ * WARNING: this value limits every other bandwidth of the
+ * WebRTC pipeline this client-to-server stream belongs to. This includes every
+ * other user subscribed to the stream
+ */
+ public Integer getVideoMaxSendBandwidth() {
+ return videoMaxSendBandwidth;
+ }
+
+ /**
+ * Defines the minimum number of Kbps that the client owning the token will try
+ * to send to Kurento Media Server. 0 means unconstrained. Giving a value to
+ * this property will override the global configuration set in OpenVidu Server configuration (parameter
+ * openvidu.streams.video.min-send-bandwidth
) for every outgoing
+ * stream of the user owning the token.
+ */
+ public Integer getVideoMinSendBandwidth() {
+ return videoMinSendBandwidth;
+ }
+
+ /**
+ * Defines the names of the filters the user owning the token will be able to
+ * apply
+ */
+ public String[] getAllowedFilters() {
+ return allowedFilters;
+ }
+
+}
diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/Session.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/Session.java
index 2ad42184..7e1afc37 100644
--- a/openvidu-java-client/src/main/java/io/openvidu/java/client/Session.java
+++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/Session.java
@@ -108,6 +108,33 @@ public class Session {
json.put("session", this.sessionId);
json.put("role", tokenOptions.getRole().name());
json.put("data", tokenOptions.getData());
+ if (tokenOptions.getKurentoOptions() != null) {
+ JSONObject kurentoOptions = new JSONObject();
+ if (tokenOptions.getKurentoOptions().getVideoMaxRecvBandwidth() != null) {
+ kurentoOptions.put("videoMaxRecvBandwidth",
+ tokenOptions.getKurentoOptions().getVideoMaxRecvBandwidth());
+ }
+ if (tokenOptions.getKurentoOptions().getVideoMinRecvBandwidth() != null) {
+ kurentoOptions.put("videoMinRecvBandwidth",
+ tokenOptions.getKurentoOptions().getVideoMinRecvBandwidth());
+ }
+ if (tokenOptions.getKurentoOptions().getVideoMaxSendBandwidth() != null) {
+ kurentoOptions.put("videoMaxSendBandwidth",
+ tokenOptions.getKurentoOptions().getVideoMaxSendBandwidth());
+ }
+ if (tokenOptions.getKurentoOptions().getVideoMinSendBandwidth() != null) {
+ kurentoOptions.put("videoMinSendBandwidth",
+ tokenOptions.getKurentoOptions().getVideoMinSendBandwidth());
+ }
+ if (tokenOptions.getKurentoOptions().getAllowedFilters().length > 0) {
+ JSONArray allowedFilters = new JSONArray();
+ for (String filter : tokenOptions.getKurentoOptions().getAllowedFilters()) {
+ allowedFilters.add(filter);
+ }
+ kurentoOptions.put("allowedFilters", allowedFilters);
+ }
+ json.put("kurentoConfiguration", kurentoOptions);
+ }
StringEntity params;
try {
params = new StringEntity(json.toString());
diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/TokenOptions.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/TokenOptions.java
index 2e09e9d7..be8d681d 100644
--- a/openvidu-java-client/src/main/java/io/openvidu/java/client/TokenOptions.java
+++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/TokenOptions.java
@@ -24,6 +24,7 @@ public class TokenOptions {
private String data;
private OpenViduRole role;
+ private KurentoOptions kurentoOptions;
/**
*
@@ -34,12 +35,13 @@ public class TokenOptions {
private String data = "";
private OpenViduRole role = OpenViduRole.PUBLISHER;
+ private KurentoOptions kurentoOptions;
/**
* Builder for {@link io.openvidu.java.client.TokenOptions}
*/
public TokenOptions build() {
- return new TokenOptions(this.data, this.role);
+ return new TokenOptions(this.data, this.role, this.kurentoOptions);
}
/**
@@ -77,11 +79,21 @@ public class TokenOptions {
return this;
}
+ /**
+ * Call this method to set a {@link io.openvidu.java.client.KurentoOptions}
+ * object for this token
+ */
+ public Builder kurentoOptions(KurentoOptions kurentoOptions) {
+ this.kurentoOptions = kurentoOptions;
+ return this;
+ }
+
}
- private TokenOptions(String data, OpenViduRole role) {
+ private TokenOptions(String data, OpenViduRole role, KurentoOptions kurentoOptions) {
this.data = data;
this.role = role;
+ this.kurentoOptions = kurentoOptions;
}
/**
@@ -98,4 +110,11 @@ public class TokenOptions {
return this.role;
}
+ /**
+ * Returns the Kurento options assigned to this token
+ */
+ public KurentoOptions getKurentoOptions() {
+ return this.kurentoOptions;
+ }
+
}