mirror of https://github.com/OpenVidu/openvidu.git
Backend clients: check if active session present when updating recording status
parent
56e75a9b81
commit
729e7590da
|
@ -25,7 +25,7 @@ declare var MediaRecorder: any;
|
|||
|
||||
|
||||
/**
|
||||
* Easy recording of [[Stream]] objects straightaway from the browser.
|
||||
* Easy recording of [[Stream]] objects straightaway from the browser. Initialized with [[OpenVidu.initLocalRecorder]] method
|
||||
*
|
||||
* > WARNING: Performing browser local recording of **remote streams** may cause some troubles. A long waiting time may be required after calling _LocalRecorder.stop()_ in this case
|
||||
*/
|
||||
|
|
|
@ -217,7 +217,13 @@ public class OpenVidu {
|
|||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
|
||||
Recording r = new Recording(httpResponseToJson(response));
|
||||
OpenVidu.activeSessions.get(r.getSessionId()).setIsBeingRecorded(true);
|
||||
Session activeSession = OpenVidu.activeSessions.get(r.getSessionId());
|
||||
if (activeSession != null) {
|
||||
activeSession.setIsBeingRecorded(true);
|
||||
} else {
|
||||
log.warn("No active session found for sessionId '" + r.getSessionId()
|
||||
+ "'. This instance of OpenVidu Java Client didn't create this session");
|
||||
}
|
||||
return r;
|
||||
} else {
|
||||
throw new OpenViduHttpException(statusCode);
|
||||
|
@ -332,7 +338,13 @@ public class OpenVidu {
|
|||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if ((statusCode == org.apache.http.HttpStatus.SC_OK)) {
|
||||
Recording r = new Recording(httpResponseToJson(response));
|
||||
OpenVidu.activeSessions.get(r.getSessionId()).setIsBeingRecorded(false);
|
||||
Session activeSession = OpenVidu.activeSessions.get(r.getSessionId());
|
||||
if (activeSession != null) {
|
||||
activeSession.setIsBeingRecorded(false);
|
||||
} else {
|
||||
log.warn("No active session found for sessionId '" + r.getSessionId()
|
||||
+ "'. This instance of OpenVidu Java Client didn't create this session");
|
||||
}
|
||||
return r;
|
||||
} else {
|
||||
throw new OpenViduHttpException(statusCode);
|
||||
|
|
|
@ -170,7 +170,12 @@ export class OpenVidu {
|
|||
if (res.status === 200) {
|
||||
// SUCCESS response from openvidu-server (Recording in JSON format). Resolve new Recording
|
||||
const r: Recording = new Recording(res.data);
|
||||
this.activeSessions.find(s => s.sessionId === r.sessionId).recording = true;
|
||||
const activeSession = this.activeSessions.find(s => s.sessionId === r.sessionId);
|
||||
if (!!activeSession) {
|
||||
activeSession.recording = true;
|
||||
} else {
|
||||
console.warn("No active session found for sessionId '" + r.sessionId + "'. This instance of OpenVidu Node Client didn't create this session");
|
||||
}
|
||||
resolve(r);
|
||||
} else {
|
||||
// ERROR response from openvidu-server. Resolve HTTP status
|
||||
|
@ -219,7 +224,12 @@ export class OpenVidu {
|
|||
if (res.status === 200) {
|
||||
// SUCCESS response from openvidu-server (Recording in JSON format). Resolve new Recording
|
||||
const r: Recording = new Recording(res.data);
|
||||
this.activeSessions.find(s => s.sessionId === r.sessionId).recording = false;
|
||||
const activeSession = this.activeSessions.find(s => s.sessionId === r.sessionId);
|
||||
if (!!activeSession) {
|
||||
activeSession.recording = false;
|
||||
} else {
|
||||
console.warn("No active session found for sessionId '" + r.sessionId + "'. This instance of OpenVidu Node Client didn't create this session");
|
||||
}
|
||||
resolve(r);
|
||||
} else {
|
||||
// ERROR response from openvidu-server. Resolve HTTP status
|
||||
|
|
|
@ -77,6 +77,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
subscribers: Subscriber[] = [];
|
||||
|
||||
// OpenVidu Node Client objects
|
||||
OV_NodeClient: OpenViduAPI;
|
||||
sessionAPI: SessionAPI;
|
||||
sessionProperties: SessionPropertiesAPI = {
|
||||
mediaMode: MediaMode.ROUTED,
|
||||
|
@ -515,7 +516,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
openSessionApiDialog() {
|
||||
const dialogRef = this.dialog.open(SessionApiDialogComponent, {
|
||||
data: {
|
||||
openVidu: new OpenViduAPI(this.openviduUrl, this.openviduSecret),
|
||||
openVidu: this.OV_NodeClient,
|
||||
session: this.sessionAPI,
|
||||
sessionId: !!this.session ? this.session.sessionId : this.sessionName
|
||||
},
|
||||
|
@ -597,11 +598,11 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
}
|
||||
|
||||
getToken(): Promise<string> {
|
||||
const OV_NodeClient = new OpenViduAPI(this.openviduUrl, this.openviduSecret);
|
||||
this.OV_NodeClient = new OpenViduAPI(this.openviduUrl, this.openviduSecret);
|
||||
if (!this.sessionProperties.customSessionId) {
|
||||
this.sessionProperties.customSessionId = this.sessionName;
|
||||
}
|
||||
return OV_NodeClient.createSession(this.sessionProperties)
|
||||
return this.OV_NodeClient.createSession(this.sessionProperties)
|
||||
.then(session_NodeClient => {
|
||||
this.sessionAPI = session_NodeClient;
|
||||
return session_NodeClient.generateToken({ role: this.participantRole });
|
||||
|
|
|
@ -56,6 +56,7 @@ export class TestScenariosComponent implements OnInit, OnDestroy {
|
|||
sessions: Session[] = [];
|
||||
|
||||
// OpenVidu Node Client objects
|
||||
OV_NodeClient: OpenViduAPI;
|
||||
sessionProperties: SessionPropertiesAPI = {
|
||||
mediaMode: MediaMode.ROUTED,
|
||||
recordingMode: RecordingMode.MANUAL,
|
||||
|
@ -274,11 +275,11 @@ export class TestScenariosComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
private getToken(): Promise<string> {
|
||||
const OV_NodeClient = new OpenViduAPI(this.openviduUrl, this.openviduSecret);
|
||||
this.OV_NodeClient = new OpenViduAPI(this.openviduUrl, this.openviduSecret);
|
||||
if (!this.sessionProperties.customSessionId) {
|
||||
this.sessionProperties.customSessionId = this.fixedSessionId;
|
||||
}
|
||||
return OV_NodeClient.createSession(this.sessionProperties)
|
||||
return this.OV_NodeClient.createSession(this.sessionProperties)
|
||||
.then(session_NodeClient => {
|
||||
return session_NodeClient.generateToken();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue