Skip to content

Commit

Permalink
Implements recording
Browse files Browse the repository at this point in the history
  • Loading branch information
hristoterezov committed Dec 31, 2015
1 parent ce43ce4 commit c8c6a6d
Show file tree
Hide file tree
Showing 2 changed files with 971 additions and 1,171 deletions.
35 changes: 24 additions & 11 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,16 @@ const APP = {
};

function initConference(localTracks, connection) {
let room = connection.initJitsiConference(APP.conference.roomName, {
let options = {
openSctp: config.openSctp,
disableAudioLevels: config.disableAudioLevels
});
};
if(config.enableRecording) {
options.recordingType = (config.hosts &&
(typeof config.hosts.jirecon != "undefined"))?
"jirecon" : "colibri";
}
let room = connection.initJitsiConference(APP.conference.roomName, options);
APP.conference._room = room; // FIXME do not use this

const addTrack = (track) => {
Expand Down Expand Up @@ -414,6 +420,15 @@ function initConference(localTracks, connection) {
room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, function (id, displayName) {
APP.UI.changeDisplayName(id, displayName);
});

room.on(ConferenceEvents.RECORDING_STATE_CHANGED, (status, error) => {
if(status == "error") {
console.error(error);
return;
}
APP.UI.updateRecordingState(status);
});

APP.UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
APP.settings.setDisplayName(nickname);
room.setDisplayName(nickname);
Expand Down Expand Up @@ -471,16 +486,14 @@ function initConference(localTracks, connection) {

// Starts or stops the recording for the conference.
APP.UI.addListener(UIEvents.RECORDING_TOGGLE, function (predefinedToken) {
// FIXME recording
// APP.xmpp.toggleRecording(function (callback) {
// if (predefinedToken) {
// callback(predefinedToken);
// return;
// }

// APP.UI.requestRecordingToken().then(callback);
if (predefinedToken) {
room.toggleRecording({token: predefinedToken});
return;
}
APP.UI.requestRecordingToken().then((token) => {
room.toggleRecording({token: token});
});

// }, APP.UI.updateRecordingState);
});

APP.UI.addListener(UIEvents.TOPIC_CHANGED, function (topic) {
Expand Down
Loading

0 comments on commit c8c6a6d

Please sign in to comment.