Adds recording support

This commit is contained in:
hristoterezov 2015-12-10 17:09:34 +11:00
parent 7a244c38f6
commit e52c6cc2a3
3 changed files with 60 additions and 23 deletions

View File

@ -419,9 +419,9 @@ JitsiConference.prototype.sendTones = function (tones, duration, pause) {
* Returns true if the recording is supproted and false if not.
*/
JitsiConference.prototype.isRecordingSupported = function () {
// if(this.room)
// return this.room.isRecordingSupported();
// return false;
if(this.room)
return this.room.isRecordingSupported();
return false;
};
/**
@ -429,18 +429,18 @@ JitsiConference.prototype.isRecordingSupported = function () {
* and "off" if the recording is not started.
*/
JitsiConference.prototype.getRecordingState = function () {
// if(this.room)
// return this.room.getRecordingState();
// return "off";
if(this.room)
return this.room.getRecordingState();
return "off";
}
/**
* Returns the url of the recorded video.
*/
JitsiConference.prototype.getRecordingURL = function () {
// if(this.room)
// return this.room.getRecordingURL();
// return null;
if(this.room)
return this.room.getRecordingURL();
return null;
}
/**
@ -448,8 +448,8 @@ JitsiConference.prototype.getRecordingURL = function () {
* @param token a token for authentication.
*/
JitsiConference.prototype.toggleRecording = function (token) {
// if(this.room)
// this.room.toggleRecording(token);
if(this.room)
this.room.toggleRecording(token);
}
/**
@ -493,6 +493,9 @@ function setupListeners(conference) {
conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
});
conference.room.addListener(XMPPEvents.RECORDING_STATE_CHANGED, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.RECORDING_STATE_CHANGED);
});
conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);

View File

@ -421,9 +421,9 @@ JitsiConference.prototype.sendTones = function (tones, duration, pause) {
* Returns true if the recording is supproted and false if not.
*/
JitsiConference.prototype.isRecordingSupported = function () {
// if(this.room)
// return this.room.isRecordingSupported();
// return false;
if(this.room)
return this.room.isRecordingSupported();
return false;
};
/**
@ -431,18 +431,18 @@ JitsiConference.prototype.isRecordingSupported = function () {
* and "off" if the recording is not started.
*/
JitsiConference.prototype.getRecordingState = function () {
// if(this.room)
// return this.room.getRecordingState();
// return "off";
if(this.room)
return this.room.getRecordingState();
return "off";
}
/**
* Returns the url of the recorded video.
*/
JitsiConference.prototype.getRecordingURL = function () {
// if(this.room)
// return this.room.getRecordingURL();
// return null;
if(this.room)
return this.room.getRecordingURL();
return null;
}
/**
@ -450,8 +450,8 @@ JitsiConference.prototype.getRecordingURL = function () {
* @param token a token for authentication.
*/
JitsiConference.prototype.toggleRecording = function (token) {
// if(this.room)
// this.room.toggleRecording(token);
if(this.room)
this.room.toggleRecording(token);
}
/**
@ -495,6 +495,9 @@ function setupListeners(conference) {
conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
});
conference.room.addListener(XMPPEvents.RECORDING_STATE_CHANGED, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.RECORDING_STATE_CHANGED);
});
conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);

View File

@ -9,10 +9,19 @@ function Recording(ee, connection, focusMucJid) {
this.state = "off";
this.focusMucJid = focusMucJid;
this.url = null;
this.isRecordingSupported = false;
this.isSupported = false;
}
Recording.prototype.handleJibriPresence = function (jibri) {
var attributes = jibri.attributes;
if(!attributes)
return;
this.isSupported = (attributes.status && attributes.status !== "undefined");
if(this.isSupported) {
this.url = attributes.url || null;
this.state = attributes.status || "off";
}
this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED);
};
@ -67,4 +76,26 @@ Recording.prototype.toggleRecording = function (token) {
);
};
/**
* Returns true if the recording is supproted and false if not.
*/
Recording.prototype.isSupported = function () {
return this.isSupported;
};
/**
* Returns null if the recording is not supported, "on" if the recording started
* and "off" if the recording is not started.
*/
Recording.prototype.getState = function () {
return this.state;
}
/**
* Returns the url of the recorded video.
*/
Recording.prototype.getURL = function () {
return this.url;
}
module.exports = Recording;