Removed deprecated finally statements from mcs-core
This commit is contained in:
parent
b52c705d68
commit
dc0230ef1f
@ -107,15 +107,11 @@ module.exports = class MediaController {
|
||||
|
||||
Logger.info("[mcs-controller] PublishAndSubscribe return a SDP session with ID", session.id);
|
||||
resolve({userId, sessionId});
|
||||
session.sessionStarted();
|
||||
}
|
||||
catch (err) {
|
||||
reject(this._handleError(err));
|
||||
}
|
||||
finally {
|
||||
if (typeof err === 'undefined' && session) {
|
||||
session.sessionStarted();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -215,29 +211,28 @@ module.exports = class MediaController {
|
||||
}
|
||||
}
|
||||
|
||||
async startRecording (userId, sourceId, recordingPath) {
|
||||
Logger.info("[mcs-controller] startRecording ", sourceId);
|
||||
try {
|
||||
const user = await this.getUserMCS(userId);
|
||||
const sourceSession = this.getMediaSession(sourceId);
|
||||
startRecording (userId, sourceId, recordingPath) {
|
||||
|
||||
const session = await user.addRecording(recordingPath);
|
||||
const answer = await user.startSession(session.id);
|
||||
await sourceSession.connect(session._mediaElement);
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
Logger.info("[mcs-controller] startRecording ", sourceId);
|
||||
const user = await this.getUserMCS(userId);
|
||||
const sourceSession = this.getMediaSession(sourceId);
|
||||
|
||||
sourceSession.subscribedSessions.push(session.id);
|
||||
this._mediaSessions[session.id] = session;
|
||||
const session = await user.addRecording(recordingPath);
|
||||
const answer = await user.startSession(session.id);
|
||||
await sourceSession.connect(session._mediaElement);
|
||||
|
||||
return Promise.resolve(answer);
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(this._handleError(err));
|
||||
}
|
||||
finally {
|
||||
if (typeof err === 'undefined' && session) {
|
||||
sourceSession.subscribedSessions.push(session.id);
|
||||
this._mediaSessions[session.id] = session;
|
||||
|
||||
resolve(answer);
|
||||
session.sessionStarted();
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
reject(this._handleError(err));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async stopRecording (userId, sourceId, recId) {
|
||||
|
@ -67,6 +67,7 @@ module.exports = class SfuUser extends User {
|
||||
}
|
||||
|
||||
addRecording (recordingPath) {
|
||||
try {
|
||||
const session = new RecordingSession(this.emitter, this.roomId, recordingPath);
|
||||
this.emitter.emit(C.EVENT.NEW_SESSION+this.id, session.id);
|
||||
|
||||
@ -81,6 +82,10 @@ module.exports = class SfuUser extends User {
|
||||
Logger.info("[mcs-sfu-user] Added new recording session", session.id, "to user", this.id);
|
||||
|
||||
return session;
|
||||
}
|
||||
catch (err) {
|
||||
this._handleError(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user