mirror of https://github.com/OpenVidu/openvidu.git
openvidu-java-client/openvidu-node-client: "record" on TokenOptions
parent
7a9c6271dd
commit
a146b55803
|
@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonNull;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
|
||||||
|
@ -120,8 +121,22 @@ public class Session {
|
||||||
|
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("session", this.sessionId);
|
json.addProperty("session", this.sessionId);
|
||||||
json.addProperty("role", tokenOptions.getRole().name());
|
|
||||||
json.addProperty("data", tokenOptions.getData());
|
if (tokenOptions.getData() != null) {
|
||||||
|
json.addProperty("data", tokenOptions.getData());
|
||||||
|
} else {
|
||||||
|
json.add("data", JsonNull.INSTANCE);
|
||||||
|
}
|
||||||
|
if (tokenOptions.getRole() != null) {
|
||||||
|
json.addProperty("role", tokenOptions.getRole().name());
|
||||||
|
} else {
|
||||||
|
json.add("role", JsonNull.INSTANCE);
|
||||||
|
}
|
||||||
|
if (tokenOptions.record() != null) {
|
||||||
|
json.addProperty("record", tokenOptions.record());
|
||||||
|
} else {
|
||||||
|
json.add("record", JsonNull.INSTANCE);
|
||||||
|
}
|
||||||
if (tokenOptions.getKurentoOptions() != null) {
|
if (tokenOptions.getKurentoOptions() != null) {
|
||||||
JsonObject kurentoOptions = new JsonObject();
|
JsonObject kurentoOptions = new JsonObject();
|
||||||
if (tokenOptions.getKurentoOptions().getVideoMaxRecvBandwidth() != null) {
|
if (tokenOptions.getKurentoOptions().getVideoMaxRecvBandwidth() != null) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class TokenOptions {
|
||||||
|
|
||||||
private String data;
|
private String data;
|
||||||
private OpenViduRole role;
|
private OpenViduRole role;
|
||||||
|
private Boolean record;
|
||||||
private KurentoOptions kurentoOptions;
|
private KurentoOptions kurentoOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,15 +34,16 @@ public class TokenOptions {
|
||||||
*/
|
*/
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private String data = "";
|
private String data;
|
||||||
private OpenViduRole role = OpenViduRole.PUBLISHER;
|
private OpenViduRole role;
|
||||||
|
private Boolean record;
|
||||||
private KurentoOptions kurentoOptions;
|
private KurentoOptions kurentoOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder for {@link io.openvidu.java.client.TokenOptions}
|
* Builder for {@link io.openvidu.java.client.TokenOptions}
|
||||||
*/
|
*/
|
||||||
public TokenOptions build() {
|
public TokenOptions build() {
|
||||||
return new TokenOptions(this.data, this.role, this.kurentoOptions);
|
return new TokenOptions(this.data, this.role, this.record, this.kurentoOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,6 +81,17 @@ public class TokenOptions {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this method to flag the streams published by the participant
|
||||||
|
* owning this token to be recorded or not. This only affects <a href=
|
||||||
|
* "https://docs.openvidu.io/en/stable/advanced-features/recording#selecting-streams-to-be-recorded"
|
||||||
|
* target="_blank">INDIVIDUAL recording</a>. If not set by default will be true
|
||||||
|
*/
|
||||||
|
public Builder record(boolean record) {
|
||||||
|
this.record = record;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this method to set a {@link io.openvidu.java.client.KurentoOptions}
|
* Call this method to set a {@link io.openvidu.java.client.KurentoOptions}
|
||||||
* object for this token
|
* object for this token
|
||||||
|
@ -90,9 +103,10 @@ public class TokenOptions {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TokenOptions(String data, OpenViduRole role, KurentoOptions kurentoOptions) {
|
private TokenOptions(String data, OpenViduRole role, Boolean record, KurentoOptions kurentoOptions) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.role = role;
|
this.role = role;
|
||||||
|
this.record = record;
|
||||||
this.kurentoOptions = kurentoOptions;
|
this.kurentoOptions = kurentoOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +124,16 @@ public class TokenOptions {
|
||||||
return this.role;
|
return this.role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the streams published by the participant owning this token will be
|
||||||
|
* recorded or not. This only affects <a href=
|
||||||
|
* "https://docs.openvidu.io/en/stable/advanced-features/recording#selecting-streams-to-be-recorded"
|
||||||
|
* target="_blank">INDIVIDUAL recording</a>
|
||||||
|
*/
|
||||||
|
public Boolean record() {
|
||||||
|
return this.record;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Kurento options assigned to this token
|
* Returns the Kurento options assigned to this token
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -102,9 +102,10 @@ export class Session {
|
||||||
|
|
||||||
const data = JSON.stringify({
|
const data = JSON.stringify({
|
||||||
session: this.sessionId,
|
session: this.sessionId,
|
||||||
role: (!!tokenOptions && !!tokenOptions.role) ? tokenOptions.role : OpenViduRole.PUBLISHER,
|
data: (!!tokenOptions && !!tokenOptions.data) ? tokenOptions.data : null,
|
||||||
data: (!!tokenOptions && !!tokenOptions.data) ? tokenOptions.data : '',
|
role: (!!tokenOptions && !!tokenOptions.role) ? tokenOptions.role : null,
|
||||||
kurentoOptions: (!!tokenOptions && !!tokenOptions.kurentoOptions) ? tokenOptions.kurentoOptions : {},
|
record: !!tokenOptions ? tokenOptions.record : null,
|
||||||
|
kurentoOptions: (!!tokenOptions && !!tokenOptions.kurentoOptions) ? tokenOptions.kurentoOptions : null
|
||||||
});
|
});
|
||||||
|
|
||||||
axios.post(
|
axios.post(
|
||||||
|
|
|
@ -32,9 +32,18 @@ export interface TokenOptions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The role assigned to this token
|
* The role assigned to this token
|
||||||
|
*
|
||||||
|
* @default PUBLISHER
|
||||||
*/
|
*/
|
||||||
role?: OpenViduRole;
|
role?: OpenViduRole;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to record the streams published by the participant owning this token or not. This only affects [INDIVIDUAL recording](/en/stable/advanced-features/recording#selecting-streams-to-be-recorded)
|
||||||
|
*
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
record?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **WARNING**: experimental option. This interface may change in the near future
|
* **WARNING**: experimental option. This interface may change in the near future
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue