"Archive" to "Recording" in openvidu-server, openvidu-java-client and openvidu-node-client

pull/73/head
pabloFuente 2018-04-18 10:39:39 +02:00
parent 2926c64a4e
commit 14c246f00f
30 changed files with 150 additions and 153 deletions

View File

@ -1,7 +0,0 @@
package io.openvidu.java.client;
public enum ArchiveMode {
ALWAYS, // The session is archived automatically (as soon as there are clients publishing streams to the session)
MANUAL; // The session is not archived automatically. To archive the session, you can call the OpenVidu.StartArchive() method
}

View File

@ -89,7 +89,7 @@ public class OpenVidu {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Archive startRecording(String sessionId) throws OpenViduException { public Recording startRecording(String sessionId) throws OpenViduException {
try { try {
HttpPost request = new HttpPost(this.urlOpenViduServer + API_RECORDINGS + API_RECORDINGS_START); HttpPost request = new HttpPost(this.urlOpenViduServer + API_RECORDINGS + API_RECORDINGS_START);
@ -104,7 +104,7 @@ public class OpenVidu {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
return new Archive(OpenVidu.httpResponseToJson(response)); return new Recording(OpenVidu.httpResponseToJson(response));
} else { } else {
throw new OpenViduException(Code.RECORDING_START_ERROR_CODE, Integer.toString(statusCode)); throw new OpenViduException(Code.RECORDING_START_ERROR_CODE, Integer.toString(statusCode));
} }
@ -114,7 +114,7 @@ public class OpenVidu {
} }
} }
public Archive stopRecording(String recordingId) throws OpenViduException { public Recording stopRecording(String recordingId) throws OpenViduException {
try { try {
HttpPost request = new HttpPost( HttpPost request = new HttpPost(
this.urlOpenViduServer + API_RECORDINGS + API_RECORDINGS_STOP + "/" + recordingId); this.urlOpenViduServer + API_RECORDINGS + API_RECORDINGS_STOP + "/" + recordingId);
@ -122,7 +122,7 @@ public class OpenVidu {
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
return new Archive(OpenVidu.httpResponseToJson(response)); return new Recording(OpenVidu.httpResponseToJson(response));
} else { } else {
throw new OpenViduException(Code.RECORDING_STOP_ERROR_CODE, Integer.toString(statusCode)); throw new OpenViduException(Code.RECORDING_STOP_ERROR_CODE, Integer.toString(statusCode));
} }
@ -132,14 +132,14 @@ public class OpenVidu {
} }
} }
public Archive getRecording(String recordingId) throws OpenViduException { public Recording getRecording(String recordingId) throws OpenViduException {
try { try {
HttpGet request = new HttpGet(this.urlOpenViduServer + API_RECORDINGS + "/" + recordingId); HttpGet request = new HttpGet(this.urlOpenViduServer + API_RECORDINGS + "/" + recordingId);
HttpResponse response = myHttpClient.execute(request); HttpResponse response = myHttpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
return new Archive(OpenVidu.httpResponseToJson(response)); return new Recording(OpenVidu.httpResponseToJson(response));
} else { } else {
throw new OpenViduException(Code.RECORDING_LIST_ERROR_CODE, Integer.toString(statusCode)); throw new OpenViduException(Code.RECORDING_LIST_ERROR_CODE, Integer.toString(statusCode));
} }
@ -149,20 +149,20 @@ public class OpenVidu {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<Archive> listRecordings() throws OpenViduException { public List<Recording> listRecordings() throws OpenViduException {
try { try {
HttpGet request = new HttpGet(this.urlOpenViduServer + API_RECORDINGS); HttpGet request = new HttpGet(this.urlOpenViduServer + API_RECORDINGS);
HttpResponse response = myHttpClient.execute(request); HttpResponse response = myHttpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode(); int statusCode = response.getStatusLine().getStatusCode();
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) { if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
List<Archive> archives = new ArrayList<>(); List<Recording> recordings = new ArrayList<>();
JSONObject json = OpenVidu.httpResponseToJson(response); JSONObject json = OpenVidu.httpResponseToJson(response);
JSONArray array = (JSONArray) json.get("items"); JSONArray array = (JSONArray) json.get("items");
array.forEach(item -> { array.forEach(item -> {
archives.add(new Archive((JSONObject) item)); recordings.add(new Recording((JSONObject) item));
}); });
return archives; return recordings;
} else { } else {
throw new OpenViduException(Code.RECORDING_LIST_ERROR_CODE, Integer.toString(statusCode)); throw new OpenViduException(Code.RECORDING_LIST_ERROR_CODE, Integer.toString(statusCode));
} }

View File

@ -2,7 +2,7 @@ package io.openvidu.java.client;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
public class Archive { public class Recording {
public enum Status { public enum Status {
starting, // The recording is starting (cannot be stopped) starting, // The recording is starting (cannot be stopped)
@ -13,7 +13,7 @@ public class Archive {
failed; // The recording has failed failed; // The recording has failed
} }
private Archive.Status status; private Recording.Status status;
private String id; private String id;
private String name; private String name;
@ -25,7 +25,7 @@ public class Archive {
private boolean hasAudio = true; private boolean hasAudio = true;
private boolean hasVideo = true; private boolean hasVideo = true;
public Archive(JSONObject json) { public Recording(JSONObject json) {
this.id = (String) json.get("id"); this.id = (String) json.get("id");
this.name = (String) json.get("name"); this.name = (String) json.get("name");
this.sessionId = (String) json.get("sessionId"); this.sessionId = (String) json.get("sessionId");
@ -35,10 +35,10 @@ public class Archive {
this.url = (String) json.get("url"); this.url = (String) json.get("url");
this.hasAudio = (boolean) json.get("hasAudio"); this.hasAudio = (boolean) json.get("hasAudio");
this.hasVideo = (boolean) json.get("hasVideo"); this.hasVideo = (boolean) json.get("hasVideo");
this.status = Archive.Status.valueOf((String) json.get("status")); this.status = Recording.Status.valueOf((String) json.get("status"));
} }
public Archive.Status getStatus() { public Recording.Status getStatus() {
return status; return status;
} }

View File

@ -1,6 +1,6 @@
package io.openvidu.java.client; package io.openvidu.java.client;
public enum ArchiveLayout { public enum RecordingLayout {
BEST_FIT, // All the videos are evenly distributed, taking up as much space as possible BEST_FIT, // All the videos are evenly distributed, taking up as much space as possible
PICTURE_IN_PICTURE, PICTURE_IN_PICTURE,
VERTICAL_PRESENTATION, VERTICAL_PRESENTATION,

View File

@ -0,0 +1,6 @@
package io.openvidu.java.client;
public enum RecordingMode {
ALWAYS, // The session is recorded automatically (as soon as there are clients publishing streams to the session)
MANUAL; // The session is not recorded automatically. To record the session, you can call the OpenVidu.startRecording() method
}

View File

@ -44,8 +44,8 @@ public class Session {
HttpPost request = new HttpPost(this.urlOpenViduServer + API_SESSIONS); HttpPost request = new HttpPost(this.urlOpenViduServer + API_SESSIONS);
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("archiveLayout", properties.archiveLayout().name()); json.put("recordingLayout", properties.recordingLayout().name());
json.put("archiveMode", properties.archiveMode().name()); json.put("recordingMode", properties.recordingMode().name());
json.put("mediaMode", properties.mediaMode().name()); json.put("mediaMode", properties.mediaMode().name());
StringEntity params = new StringEntity(json.toString()); StringEntity params = new StringEntity(json.toString());

View File

@ -3,17 +3,17 @@ package io.openvidu.java.client;
public class SessionProperties { public class SessionProperties {
private MediaMode mediaMode; private MediaMode mediaMode;
private ArchiveMode archiveMode; private RecordingMode recordingMode;
private ArchiveLayout archiveLayout; private RecordingLayout recordingLayout;
public static class Builder { public static class Builder {
private MediaMode mediaMode = MediaMode.ROUTED; private MediaMode mediaMode = MediaMode.ROUTED;
private ArchiveMode archiveMode = ArchiveMode.MANUAL; private RecordingMode recordingMode = RecordingMode.MANUAL;
private ArchiveLayout archiveLayout = ArchiveLayout.BEST_FIT; private RecordingLayout recordingLayout = RecordingLayout.BEST_FIT;
public SessionProperties build() { public SessionProperties build() {
return new SessionProperties(this.mediaMode, this.archiveMode, this.archiveLayout); return new SessionProperties(this.mediaMode, this.recordingMode, this.recordingLayout);
} }
public SessionProperties.Builder mediaMode(MediaMode mediaMode) { public SessionProperties.Builder mediaMode(MediaMode mediaMode) {
@ -21,13 +21,13 @@ public class SessionProperties {
return this; return this;
} }
public SessionProperties.Builder archiveMode(ArchiveMode archiveMode) { public SessionProperties.Builder recordingMode(RecordingMode recordingMode) {
this.archiveMode = archiveMode; this.recordingMode = recordingMode;
return this; return this;
} }
public SessionProperties.Builder archiveLayout(ArchiveLayout archiveLayout) { public SessionProperties.Builder recordingLayout(RecordingLayout recordingLayout) {
this.archiveLayout = archiveLayout; this.recordingLayout = recordingLayout;
return this; return this;
} }
@ -35,26 +35,26 @@ public class SessionProperties {
protected SessionProperties() { protected SessionProperties() {
this.mediaMode = MediaMode.ROUTED; this.mediaMode = MediaMode.ROUTED;
this.archiveMode = ArchiveMode.MANUAL; this.recordingMode = RecordingMode.MANUAL;
this.archiveLayout = ArchiveLayout.BEST_FIT; this.recordingLayout = RecordingLayout.BEST_FIT;
} }
private SessionProperties(MediaMode mediaMode, ArchiveMode archiveMode, ArchiveLayout archiveLayout) { private SessionProperties(MediaMode mediaMode, RecordingMode recordingMode, RecordingLayout recordingLayout) {
this.mediaMode = mediaMode; this.mediaMode = mediaMode;
this.archiveMode = archiveMode; this.recordingMode = recordingMode;
this.archiveLayout = archiveLayout; this.recordingLayout = recordingLayout;
} }
public ArchiveMode archiveMode() { public RecordingMode recordingMode() {
return this.archiveMode; return this.recordingMode;
} }
public MediaMode mediaMode() { public MediaMode mediaMode() {
return this.mediaMode; return this.mediaMode;
} }
public ArchiveLayout archiveLayout() { public RecordingLayout recordingLayout() {
return this.archiveLayout; return this.recordingLayout;
} }
} }

View File

@ -1,6 +1,6 @@
import { Session } from "./Session"; import { Session } from "./Session";
import { SessionProperties } from "./SessionProperties"; import { SessionProperties } from "./SessionProperties";
import { Archive } from "./Archive"; import { Recording } from "./Recording";
export declare class OpenVidu { export declare class OpenVidu {
private urlOpenViduServer; private urlOpenViduServer;
private static readonly API_RECORDINGS; private static readonly API_RECORDINGS;
@ -11,10 +11,10 @@ export declare class OpenVidu {
private basicAuth; private basicAuth;
constructor(urlOpenViduServer: string, secret: string); constructor(urlOpenViduServer: string, secret: string);
createSession(properties?: SessionProperties): Session; createSession(properties?: SessionProperties): Session;
startRecording(sessionId: string): Promise<Archive>; startRecording(sessionId: string): Promise<Recording>;
stopRecording(recordingId: string): Promise<Archive>; stopRecording(recordingId: string): Promise<Recording>;
getRecording(recordingId: string): Promise<Archive>; getRecording(recordingId: string): Promise<Recording>;
listRecordings(): Promise<Archive[]>; listRecordings(): Promise<Recording[]>;
deleteRecording(recordingId: string): Promise<Error>; deleteRecording(recordingId: string): Promise<Error>;
private getBasicAuth(secret); private getBasicAuth(secret);
private setHostnameAndPort(); private setHostnameAndPort();

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var Session_1 = require("./Session"); var Session_1 = require("./Session");
var Archive_1 = require("./Archive"); var Recording_1 = require("./Recording");
var https = require('https'); var https = require('https');
var OpenVidu = /** @class */ (function () { var OpenVidu = /** @class */ (function () {
function OpenVidu(urlOpenViduServer, secret) { function OpenVidu(urlOpenViduServer, secret) {
@ -37,8 +37,8 @@ var OpenVidu = /** @class */ (function () {
}); });
res.on('end', function () { res.on('end', function () {
if (res.statusCode === 200) { if (res.statusCode === 200) {
// SUCCESS response from openvidu-server (Archive in JSON format). Resolve new Archive // SUCCESS response from openvidu-server (Recording in JSON format). Resolve new Recording
resolve(new Archive_1.Archive(JSON.parse(body))); resolve(new Recording_1.Recording(JSON.parse(body)));
} }
else { else {
// ERROR response from openvidu-server. Resolve HTTP status // ERROR response from openvidu-server. Resolve HTTP status
@ -74,8 +74,8 @@ var OpenVidu = /** @class */ (function () {
}); });
res.on('end', function () { res.on('end', function () {
if (res.statusCode === 200) { if (res.statusCode === 200) {
// SUCCESS response from openvidu-server (Archive in JSON format). Resolve new Archive // SUCCESS response from openvidu-server (Recording in JSON format). Resolve new Recording
resolve(new Archive_1.Archive(JSON.parse(body))); resolve(new Recording_1.Recording(JSON.parse(body)));
} }
else { else {
// ERROR response from openvidu-server. Resolve HTTP status // ERROR response from openvidu-server. Resolve HTTP status
@ -111,8 +111,8 @@ var OpenVidu = /** @class */ (function () {
}); });
res.on('end', function () { res.on('end', function () {
if (res.statusCode === 200) { if (res.statusCode === 200) {
// SUCCESS response from openvidu-server (Archive in JSON format). Resolve new Archive // SUCCESS response from openvidu-server (Recording in JSON format). Resolve new Recording
resolve(new Archive_1.Archive(JSON.parse(body))); resolve(new Recording_1.Recording(JSON.parse(body)));
} }
else { else {
// ERROR response from openvidu-server. Resolve HTTP status // ERROR response from openvidu-server. Resolve HTTP status
@ -148,13 +148,13 @@ var OpenVidu = /** @class */ (function () {
}); });
res.on('end', function () { res.on('end', function () {
if (res.statusCode === 200) { if (res.statusCode === 200) {
// SUCCESS response from openvidu-server (JSON arrays of Archives in JSON format). Resolve list of new Archives // SUCCESS response from openvidu-server (JSON arrays of recordings in JSON format). Resolve list of new recordings
var archiveArray = []; var recordingArray = [];
var responseItems = JSON.parse(body)['items']; var responseItems = JSON.parse(body)['items'];
for (var i = 0; i < responseItems.length; i++) { for (var i = 0; i < responseItems.length; i++) {
archiveArray.push(new Archive_1.Archive(responseItems[i])); recordingArray.push(new Recording_1.Recording(responseItems[i]));
} }
resolve(archiveArray); resolve(recordingArray);
} }
else { else {
// ERROR response from openvidu-server. Resolve HTTP status // ERROR response from openvidu-server. Resolve HTTP status

File diff suppressed because one or more lines are too long

View File

@ -23,8 +23,8 @@ var Session = /** @class */ (function () {
return; return;
} }
var requestBody = JSON.stringify({ var requestBody = JSON.stringify({
'archiveLayout': this.properties.archiveLayout(), 'recordingLayout': this.properties.recordingLayout(),
'archiveMode': this.properties.archiveMode(), 'recordingMode': this.properties.recordingMode(),
'mediaMode': this.properties.mediaMode() 'mediaMode': this.properties.mediaMode()
}); });
var options = { var options = {

View File

@ -1 +1 @@
{"version":3,"file":"Session.js","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":";;AACA,+CAA8C;AAC9C,yDAAwD;AAKxD,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;A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E,CAAC,KAAK,EAAE;gBACV,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC;oBACzB,uDAAuD;oBACvD,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBACxB,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACJ,2DAA2D;oBAC3D,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBAClC,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACvB,GAAG,CAAC,GAAG,EAAE,CAAC;IACd,CAAC;IAEM,+BAAa,GAApB;QACI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IA3HuB,oBAAY,GAAW,eAAe,CAAC;IACvC,kBAAU,GAAW,aAAa,CAAC;IA4H/D,cAAC;CAAA,AA/HD,IA+HC;AA/HY,0BAAO"}

View File

@ -4,6 +4,6 @@ export * from './Session';
export * from './SessionProperties'; export * from './SessionProperties';
export * from './TokenOptions'; export * from './TokenOptions';
export * from './MediaMode'; export * from './MediaMode';
export * from './ArchiveLayout'; export * from './RecordingLayout';
export * from './ArchiveMode'; export * from './RecordingMode';
export * from './Archive'; export * from './Recording';

View File

@ -9,7 +9,7 @@ __export(require("./Session"));
__export(require("./SessionProperties")); __export(require("./SessionProperties"));
__export(require("./TokenOptions")); __export(require("./TokenOptions"));
__export(require("./MediaMode")); __export(require("./MediaMode"));
__export(require("./ArchiveLayout")); __export(require("./RecordingLayout"));
__export(require("./ArchiveMode")); __export(require("./RecordingMode"));
__export(require("./Archive")); __export(require("./Recording"));
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,gCAA2B;AAC3B,oCAA+B;AAC/B,+BAA0B;AAC1B,yCAAoC;AACpC,oCAA+B;AAC/B,iCAA4B;AAC5B,qCAAgC;AAChC,mCAA8B;AAC9B,+BAA0B"} {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,gCAA2B;AAC3B,oCAA+B;AAC/B,+BAA0B;AAC1B,yCAAoC;AACpC,oCAA+B;AAC/B,iCAA4B;AAC5B,uCAAkC;AAClC,qCAAgC;AAChC,iCAA4B"}

View File

@ -1,4 +0,0 @@
export enum ArchiveMode {
ALWAYS = 'ALWAYS', // The session is archived automatically (as soon as there are clients publishing streams to the session)
MANUAL = 'MANUAL' // The session is not archived automatically. To archive the session, you can call the OpenVidu.StartArchive() method
}

View File

@ -1,6 +1,6 @@
import { Session } from "./Session"; import { Session } from "./Session";
import { SessionProperties } from "./SessionProperties"; import { SessionProperties } from "./SessionProperties";
import { Archive } from "./Archive"; import { Recording } from "./Recording";
declare const Buffer; declare const Buffer;
let https = require('https'); let https = require('https');
@ -24,8 +24,8 @@ export class OpenVidu {
return new Session(this.hostname, this.port, this.basicAuth, properties); return new Session(this.hostname, this.port, this.basicAuth, properties);
} }
public startRecording(sessionId: string): Promise<Archive> { public startRecording(sessionId: string): Promise<Recording> {
return new Promise<Archive>((resolve, reject) => { return new Promise<Recording>((resolve, reject) => {
let requestBody = JSON.stringify({ let requestBody = JSON.stringify({
'session': sessionId 'session': sessionId
@ -50,8 +50,8 @@ export class OpenVidu {
}); });
res.on('end', () => { res.on('end', () => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
// SUCCESS response from openvidu-server (Archive in JSON format). Resolve new Archive // SUCCESS response from openvidu-server (Recording in JSON format). Resolve new Recording
resolve(new Archive(JSON.parse(body))); resolve(new Recording(JSON.parse(body)));
} else { } else {
// ERROR response from openvidu-server. Resolve HTTP status // ERROR response from openvidu-server. Resolve HTTP status
reject(new Error(res.statusCode)); reject(new Error(res.statusCode));
@ -68,8 +68,8 @@ export class OpenVidu {
}); });
} }
public stopRecording(recordingId: string): Promise<Archive> { public stopRecording(recordingId: string): Promise<Recording> {
return new Promise<Archive>((resolve, reject) => { return new Promise<Recording>((resolve, reject) => {
let options = { let options = {
hostname: this.hostname, hostname: this.hostname,
@ -89,8 +89,8 @@ export class OpenVidu {
}); });
res.on('end', () => { res.on('end', () => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
// SUCCESS response from openvidu-server (Archive in JSON format). Resolve new Archive // SUCCESS response from openvidu-server (Recording in JSON format). Resolve new Recording
resolve(new Archive(JSON.parse(body))); resolve(new Recording(JSON.parse(body)));
} else { } else {
// ERROR response from openvidu-server. Resolve HTTP status // ERROR response from openvidu-server. Resolve HTTP status
reject(new Error(res.statusCode)); reject(new Error(res.statusCode));
@ -107,8 +107,8 @@ export class OpenVidu {
}); });
} }
public getRecording(recordingId: string): Promise<Archive> { public getRecording(recordingId: string): Promise<Recording> {
return new Promise<Archive>((resolve, reject) => { return new Promise<Recording>((resolve, reject) => {
let options = { let options = {
hostname: this.hostname, hostname: this.hostname,
@ -128,8 +128,8 @@ export class OpenVidu {
}); });
res.on('end', () => { res.on('end', () => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
// SUCCESS response from openvidu-server (Archive in JSON format). Resolve new Archive // SUCCESS response from openvidu-server (Recording in JSON format). Resolve new Recording
resolve(new Archive(JSON.parse(body))); resolve(new Recording(JSON.parse(body)));
} else { } else {
// ERROR response from openvidu-server. Resolve HTTP status // ERROR response from openvidu-server. Resolve HTTP status
reject(new Error(res.statusCode)); reject(new Error(res.statusCode));
@ -146,8 +146,8 @@ export class OpenVidu {
}); });
} }
public listRecordings(): Promise<Archive[]> { public listRecordings(): Promise<Recording[]> {
return new Promise<Archive[]>((resolve, reject) => { return new Promise<Recording[]>((resolve, reject) => {
let options = { let options = {
hostname: this.hostname, hostname: this.hostname,
@ -167,13 +167,13 @@ export class OpenVidu {
}); });
res.on('end', () => { res.on('end', () => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
// SUCCESS response from openvidu-server (JSON arrays of Archives in JSON format). Resolve list of new Archives // SUCCESS response from openvidu-server (JSON arrays of recordings in JSON format). Resolve list of new recordings
let archiveArray: Archive[] = []; let recordingArray: Recording[] = [];
let responseItems = JSON.parse(body)['items']; let responseItems = JSON.parse(body)['items'];
for (let i = 0; i < responseItems.length; i++) { for (let i = 0; i < responseItems.length; i++) {
archiveArray.push(new Archive(responseItems[i])); recordingArray.push(new Recording(responseItems[i]));
} }
resolve(archiveArray); resolve(recordingArray);
} else { } else {
// ERROR response from openvidu-server. Resolve HTTP status // ERROR response from openvidu-server. Resolve HTTP status
reject(new Error(res.statusCode)); reject(new Error(res.statusCode));

View File

@ -1,4 +1,4 @@
export class Archive { export class Recording {
private id: string; private id: string;
private name: string; private name: string;
@ -9,7 +9,7 @@ export class Archive {
private url: string; private url: string;
private hasaudio: boolean = true; private hasaudio: boolean = true;
private hasvideo: boolean = true; private hasvideo: boolean = true;
private status: Archive.Status; private status: Recording.Status;
constructor(json: JSON) { constructor(json: JSON) {
this.id = json['id']; this.id = json['id'];
@ -24,7 +24,7 @@ export class Archive {
this.status = json['status']; this.status = json['status'];
} }
public getStatus(): Archive.Status { public getStatus(): Recording.Status {
return this.status; return this.status;
} }
@ -65,7 +65,7 @@ export class Archive {
} }
} }
export namespace Archive { export namespace Recording {
export enum Status { export enum Status {
starting, // The recording is starting (cannot be stopped) starting, // The recording is starting (cannot be stopped)
started, // The recording has started and is going on started, // The recording has started and is going on

View File

@ -1,4 +1,4 @@
export enum ArchiveLayout { export enum RecordingLayout {
BEST_FIT = 'BEST_FIT', // All the videos are evenly distributed, taking up as much space as possible BEST_FIT = 'BEST_FIT', // All the videos are evenly distributed, taking up as much space as possible
PICTURE_IN_PICTURE = 'PICTURE_IN_PICTURE', PICTURE_IN_PICTURE = 'PICTURE_IN_PICTURE',
VERTICAL_PRESENTATION = 'VERTICAL_PRESENTATION', VERTICAL_PRESENTATION = 'VERTICAL_PRESENTATION',

View File

@ -0,0 +1,4 @@
export enum RecordingMode {
ALWAYS = 'ALWAYS', // The session is recorded automatically (as soon as there are clients publishing streams to the session)
MANUAL = 'MANUAL' // The session is not recorded automatically. To record the session, you can call the OpenVidu.startRecording() method
}

View File

@ -31,8 +31,8 @@ export class Session {
} }
let requestBody = JSON.stringify({ let requestBody = JSON.stringify({
'archiveLayout': this.properties.archiveLayout(), 'recordingLayout': this.properties.recordingLayout(),
'archiveMode': this.properties.archiveMode(), 'recordingMode': this.properties.recordingMode(),
'mediaMode': this.properties.mediaMode() 'mediaMode': this.properties.mediaMode()
}); });

View File

@ -1,21 +1,21 @@
import { MediaMode } from "./MediaMode"; import { MediaMode } from "./MediaMode";
import { ArchiveMode } from "./ArchiveMode"; import { RecordingMode } from "./RecordingMode";
import { ArchiveLayout } from "./ArchiveLayout"; import { RecordingLayout } from "./RecordingLayout";
export class SessionProperties { export class SessionProperties {
constructor(private mediaModeProp: MediaMode, private archiveModeProp: ArchiveMode, private archiveLayoutProp: ArchiveLayout) { } constructor(private mediaModeProp: MediaMode, private recordingModeProp: RecordingMode, private recordingLayoutProp: RecordingLayout) { }
mediaMode(): string { mediaMode(): string {
return this.mediaModeProp; return this.mediaModeProp;
} }
archiveMode(): ArchiveMode { recordingMode(): RecordingMode {
return this.archiveModeProp; return this.recordingModeProp;
} }
archiveLayout(): ArchiveLayout { recordingLayout(): RecordingLayout {
return this.archiveLayoutProp; return this.recordingLayoutProp;
} }
} }
@ -23,11 +23,11 @@ export namespace SessionProperties {
export class Builder { export class Builder {
private mediaModeProp: MediaMode = MediaMode.ROUTED; private mediaModeProp: MediaMode = MediaMode.ROUTED;
private archiveModeProp: ArchiveMode = ArchiveMode.MANUAL; private recordingModeProp: RecordingMode = RecordingMode.MANUAL;
private archiveLayoutProp: ArchiveLayout = ArchiveLayout.BEST_FIT; private recordingLayoutProp: RecordingLayout = RecordingLayout.BEST_FIT;
build(): SessionProperties { build(): SessionProperties {
return new SessionProperties(this.mediaModeProp, this.archiveModeProp, this.archiveLayoutProp); return new SessionProperties(this.mediaModeProp, this.recordingModeProp, this.recordingLayoutProp);
} }
mediaMode(mediaMode: MediaMode): Builder { mediaMode(mediaMode: MediaMode): Builder {
@ -35,13 +35,13 @@ export namespace SessionProperties {
return this; return this;
} }
archiveMode(archiveMode: ArchiveMode): Builder { recordingMode(recordingMode: RecordingMode): Builder {
this.archiveModeProp = archiveMode; this.recordingModeProp = recordingMode;
return this; return this;
} }
archiveLayout(archiveLayout: ArchiveLayout): Builder { recordingLayout(recordingLayout: RecordingLayout): Builder {
this.archiveLayoutProp = archiveLayout; this.recordingLayoutProp = recordingLayout;
return this; return this;
} }
}; };

View File

@ -4,6 +4,6 @@ export * from './Session';
export * from './SessionProperties'; export * from './SessionProperties';
export * from './TokenOptions'; export * from './TokenOptions';
export * from './MediaMode'; export * from './MediaMode';
export * from './ArchiveLayout'; export * from './RecordingLayout';
export * from './ArchiveMode'; export * from './RecordingMode';
export * from './Archive'; export * from './Recording';

View File

@ -356,7 +356,7 @@ public class SessionEventsHandler {
try { try {
existingParticipants = session.getParticipants(); existingParticipants = session.getParticipants();
} catch (OpenViduException exception) { } catch (OpenViduException exception) {
// Session is already closed. This happens when ArchiveMode.ALWAYS and last // Session is already closed. This happens when RecordingMode.ALWAYS and last
// participant has left the session. No notification needs to be sent // participant has left the session. No notification needs to be sent
log.warn("Session already closed when trying to send 'recordingStopped' notification"); log.warn("Session already closed when trying to send 'recordingStopped' notification");
return; return;

View File

@ -18,8 +18,8 @@ import com.google.gson.JsonSyntaxException;
import io.openvidu.client.OpenViduException; import io.openvidu.client.OpenViduException;
import io.openvidu.client.OpenViduException.Code; import io.openvidu.client.OpenViduException.Code;
import io.openvidu.client.internal.ProtocolElements; import io.openvidu.client.internal.ProtocolElements;
import io.openvidu.java.client.ArchiveLayout; import io.openvidu.java.client.RecordingLayout;
import io.openvidu.java.client.ArchiveMode; import io.openvidu.java.client.RecordingMode;
import io.openvidu.java.client.MediaMode; import io.openvidu.java.client.MediaMode;
import io.openvidu.java.client.SessionProperties; import io.openvidu.java.client.SessionProperties;
import io.openvidu.server.core.SessionManager; import io.openvidu.server.core.SessionManager;
@ -55,7 +55,7 @@ public class KurentoSessionManager extends SessionManager {
SessionProperties properties = sessionProperties.get(sessionId); SessionProperties properties = sessionProperties.get(sessionId);
if (properties == null && this.isInsecureParticipant(participant.getParticipantPrivateId())) { if (properties == null && this.isInsecureParticipant(participant.getParticipantPrivateId())) {
properties = new SessionProperties.Builder().mediaMode(MediaMode.ROUTED) properties = new SessionProperties.Builder().mediaMode(MediaMode.ROUTED)
.archiveMode(ArchiveMode.ALWAYS).archiveLayout(ArchiveLayout.BEST_FIT).build(); .recordingMode(RecordingMode.ALWAYS).recordingLayout(RecordingLayout.BEST_FIT).build();
} }
createSession(kcSessionInfo, properties); createSession(kcSessionInfo, properties);
} }
@ -153,7 +153,7 @@ public class KurentoSessionManager extends SessionManager {
} else if (remainingParticipants.size() == 1 && openviduConfig.isRecordingModuleEnabled() } else if (remainingParticipants.size() == 1 && openviduConfig.isRecordingModuleEnabled()
&& MediaMode.ROUTED.equals(session.getSessionProperties().mediaMode()) && MediaMode.ROUTED.equals(session.getSessionProperties().mediaMode())
&& ArchiveMode.ALWAYS.equals(session.getSessionProperties().archiveMode()) && RecordingMode.ALWAYS.equals(session.getSessionProperties().recordingMode())
&& ProtocolElements.RECORDER_PARTICIPANT_PUBLICID && ProtocolElements.RECORDER_PARTICIPANT_PUBLICID
.equals(remainingParticipants.iterator().next().getParticipantPublicId())) { .equals(remainingParticipants.iterator().next().getParticipantPublicId())) {
@ -230,7 +230,7 @@ public class KurentoSessionManager extends SessionManager {
if (this.openviduConfig.isRecordingModuleEnabled() if (this.openviduConfig.isRecordingModuleEnabled()
&& MediaMode.ROUTED.equals(session.getSessionProperties().mediaMode()) && MediaMode.ROUTED.equals(session.getSessionProperties().mediaMode())
&& ArchiveMode.ALWAYS.equals(session.getSessionProperties().archiveMode()) && RecordingMode.ALWAYS.equals(session.getSessionProperties().recordingMode())
&& !recordingService.sessionIsBeingRecorded(session.getSessionId()) && !recordingService.sessionIsBeingRecorded(session.getSessionId())
&& session.getActivePublishers() == 0) { && session.getActivePublishers() == 0) {
recordingService.startRecording(session); recordingService.startRecording(session);

View File

@ -105,7 +105,7 @@ public class ComposedRecordingService {
} }
String location = OpenViduServer.publicUrl.replaceFirst("wss://", ""); String location = OpenViduServer.publicUrl.replaceFirst("wss://", "");
String layoutUrl = session.getSessionProperties().archiveLayout().name().toLowerCase().replaceAll("_", "-"); String layoutUrl = session.getSessionProperties().recordingLayout().name().toLowerCase().replaceAll("_", "-");
envs.add("URL=https://OPENVIDUAPP:" + secret + "@" + location + "/#/layout-" + layoutUrl + "/" + shortSessionId envs.add("URL=https://OPENVIDUAPP:" + secret + "@" + location + "/#/layout-" + layoutUrl + "/" + shortSessionId
+ "/" + secret); + "/" + secret);

View File

@ -35,8 +35,8 @@ import org.springframework.web.bind.annotation.RestController;
import io.openvidu.client.OpenViduException; import io.openvidu.client.OpenViduException;
import io.openvidu.client.internal.ProtocolElements; import io.openvidu.client.internal.ProtocolElements;
import io.openvidu.java.client.ArchiveLayout; import io.openvidu.java.client.RecordingLayout;
import io.openvidu.java.client.ArchiveMode; import io.openvidu.java.client.RecordingMode;
import io.openvidu.java.client.MediaMode; import io.openvidu.java.client.MediaMode;
import io.openvidu.java.client.SessionProperties; import io.openvidu.java.client.SessionProperties;
import io.openvidu.server.core.ParticipantRole; import io.openvidu.server.core.ParticipantRole;
@ -71,26 +71,26 @@ public class SessionRestController {
SessionProperties.Builder builder = new SessionProperties.Builder(); SessionProperties.Builder builder = new SessionProperties.Builder();
if (params != null) { if (params != null) {
String archiveModeString = (String) params.get("archiveMode"); String recordingModeString = (String) params.get("recordingMode");
String archiveLayoutString = (String) params.get("archiveLayout"); String recordingLayoutString = (String) params.get("recordingLayout");
String mediaModeString = (String) params.get("mediaMode"); String mediaModeString = (String) params.get("mediaMode");
try { try {
if (archiveModeString != null) { if (recordingModeString != null) {
ArchiveMode archiveMode = ArchiveMode.valueOf(archiveModeString); RecordingMode recordingMode = RecordingMode.valueOf(recordingModeString);
builder = builder.archiveMode(archiveMode); builder = builder.recordingMode(recordingMode);
} }
if (archiveLayoutString != null) { if (recordingLayoutString != null) {
ArchiveLayout archiveLayout = ArchiveLayout.valueOf(archiveLayoutString); RecordingLayout recordingLayout = RecordingLayout.valueOf(recordingLayoutString);
builder = builder.archiveLayout(archiveLayout); builder = builder.recordingLayout(recordingLayout);
} }
if (mediaModeString != null) { if (mediaModeString != null) {
MediaMode mediaMode = MediaMode.valueOf(mediaModeString); MediaMode mediaMode = MediaMode.valueOf(mediaModeString);
builder = builder.mediaMode(mediaMode); builder = builder.mediaMode(mediaMode);
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return this.generateErrorResponse("ArchiveMode " + params.get("archiveMode") + " | " + "ArchiveLayout " return this.generateErrorResponse("RecordingMode " + params.get("recordingMode") + " | " + "RecordingLayout "
+ params.get("archiveLayout") + " | " + "MediaMode " + params.get("mediaMode") + params.get("recordingLayout") + " | " + "MediaMode " + params.get("mediaMode")
+ " are not defined", "/api/tokens", HttpStatus.BAD_REQUEST); + " are not defined", "/api/tokens", HttpStatus.BAD_REQUEST);
} }
} }

View File

@ -689,12 +689,10 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
/*session.on('publisherStartSpeaking', (event) => { /*session.on('publisherStartSpeaking', (event) => {
console.log('Publisher start speaking'); console.log('Publisher start speaking');
console.log(event);
}); });
session.on('publisherStopSpeaking', (event) => { session.on('publisherStopSpeaking', (event) => {
console.log('Publisher stop speaking'); console.log('Publisher stop speaking');
console.log(event);
});*/ });*/
} }

View File

@ -15,22 +15,22 @@
<h3>Session Properties</h3> <h3>Session Properties</h3>
<table> <table>
<tr> <tr>
<th>Archive Mode</th> <th>Recording Mode</th>
<th>Archive Layout</th> <th>Recording Layout</th>
<th>Media Mode</th> <th>Media Mode</th>
</tr> </tr>
<tr id="tr-session-properties"> <tr id="tr-session-properties">
<td> <td>
<mat-select placeholder="ArchiveMode" [(ngModel)]="selectedArchiveMode"> <mat-select placeholder="RecordingMode" [(ngModel)]="selectedRecordingMode">
<mat-option *ngFor="let archiveMode of archiveModes" [value]="archiveMode"> <mat-option *ngFor="let recordingMode of recordingModes" [value]="recordingMode">
{{ archiveMode }} {{ recordingMode }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</td> </td>
<td> <td>
<mat-select placeholder="ArchiveLayout" [(ngModel)]="selectedArchiveLayout"> <mat-select placeholder="RecordingLayout" [(ngModel)]="selectedRecordingLayout">
<mat-option *ngFor="let archiveLayout of archiveLayouts" [value]="archiveLayout"> <mat-option *ngFor="let recordingLayout of recordingLayouts" [value]="recordingLayout">
{{ archiveLayout }} {{ recordingLayout }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</td> </td>

View File

@ -2,7 +2,7 @@ import { Component, Input, OnInit, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs/Subscription'; import { Subscription } from 'rxjs/Subscription';
import { OpenviduRestService } from '../../services/openvidu-rest.service'; import { OpenviduRestService } from '../../services/openvidu-rest.service';
import { OpenviduParamsService } from '../../services/openvidu-params.service'; import { OpenviduParamsService } from '../../services/openvidu-params.service';
import { SessionProperties, ArchiveMode, ArchiveLayout, MediaMode } from 'openvidu-node-client'; import { SessionProperties, RecordingMode, RecordingLayout, MediaMode } from 'openvidu-node-client';
import * as colormap from 'colormap'; import * as colormap from 'colormap';
const numColors = 64; const numColors = 64;
@ -26,11 +26,11 @@ export class TestApirestComponent implements OnInit, OnDestroy {
openViduRoles = ['SUBSCRIBER', 'PUBLISHER', 'MODERATOR']; openViduRoles = ['SUBSCRIBER', 'PUBLISHER', 'MODERATOR'];
selectedRole = 'PUBLISHER'; selectedRole = 'PUBLISHER';
archiveModes = ['ALWAYS', 'MANUAL']; recordingModes = ['ALWAYS', 'MANUAL'];
selectedArchiveMode = 'MANUAL'; selectedRecordingMode = 'MANUAL';
archiveLayouts = ['BEST_FIT']; recordingLayouts = ['BEST_FIT'];
selectedArchiveLayout = 'BEST_FIT'; selectedRecordingLayout = 'BEST_FIT';
mediaModes = ['ROUTED']; mediaModes = ['ROUTED'];
selectedMediaMode = 'ROUTED'; selectedMediaMode = 'ROUTED';
@ -71,8 +71,8 @@ export class TestApirestComponent implements OnInit, OnDestroy {
private getSessionId() { private getSessionId() {
this.openviduRestService.getSessionId(this.openviduUrl, this.openviduSecret, this.openviduRestService.getSessionId(this.openviduUrl, this.openviduSecret,
new SessionProperties.Builder() new SessionProperties.Builder()
.archiveMode(ArchiveMode[this.selectedArchiveMode]) .recordingMode(RecordingMode[this.selectedRecordingMode])
.archiveLayout(ArchiveLayout[this.selectedArchiveLayout]) .recordingLayout(RecordingLayout[this.selectedRecordingLayout])
.mediaMode(MediaMode[this.selectedMediaMode]) .mediaMode(MediaMode[this.selectedMediaMode])
.build()) .build())
.then((sessionId) => { .then((sessionId) => {