|
@@ -6,6 +6,7 @@ var activecall = null;
|
6
|
6
|
var RTC = null;
|
7
|
7
|
var nickname = null;
|
8
|
8
|
var sharedKey = '';
|
|
9
|
+var recordingToken ='';
|
9
|
10
|
var roomUrl = null;
|
10
|
11
|
var ssrc2jid = {};
|
11
|
12
|
/**
|
|
@@ -613,6 +614,7 @@ $(document).bind('joined.muc', function (event, jid, info) {
|
613
|
614
|
|
614
|
615
|
if (Object.keys(connection.emuc.members).length < 1) {
|
615
|
616
|
focus = new ColibriFocus(connection, config.hosts.bridge);
|
|
617
|
+ showRecordingButton(false);
|
616
|
618
|
}
|
617
|
619
|
|
618
|
620
|
if (focus && config.etherpad_base) {
|
|
@@ -633,6 +635,7 @@ $(document).bind('joined.muc', function (event, jid, info) {
|
633
|
635
|
|
634
|
636
|
$(document).bind('entered.muc', function (event, jid, info, pres) {
|
635
|
637
|
console.log('entered', jid, info);
|
|
638
|
+
|
636
|
639
|
console.log('is focus?' + focus ? 'true' : 'false');
|
637
|
640
|
|
638
|
641
|
// Add Peer's container
|
|
@@ -643,6 +646,7 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
|
643
|
646
|
if (focus.confid === null) {
|
644
|
647
|
console.log('make new conference with', jid);
|
645
|
648
|
focus.makeConference(Object.keys(connection.emuc.members));
|
|
649
|
+ showRecordingButton(true);
|
646
|
650
|
} else {
|
647
|
651
|
console.log('invite', jid, 'into conference');
|
648
|
652
|
focus.addNewParticipant(jid);
|
|
@@ -688,17 +692,20 @@ $(document).bind('left.muc', function (event, jid) {
|
688
|
692
|
&& !sessionTerminated) {
|
689
|
693
|
console.log('welcome to our new focus... myself');
|
690
|
694
|
focus = new ColibriFocus(connection, config.hosts.bridge);
|
|
695
|
+
|
691
|
696
|
if (Object.keys(connection.emuc.members).length > 0) {
|
692
|
697
|
focus.makeConference(Object.keys(connection.emuc.members));
|
|
698
|
+ showRecordingButton(true);
|
693
|
699
|
}
|
694
|
700
|
$(document).trigger('focusechanged.muc', [focus]);
|
695
|
701
|
}
|
696
|
702
|
else if (focus && Object.keys(connection.emuc.members).length === 0) {
|
697
|
703
|
console.log('everyone left');
|
698
|
704
|
// FIXME: closing the connection is a hack to avoid some
|
699
|
|
- // problemswith reinit
|
|
705
|
+ // problems with reinit
|
700
|
706
|
disposeConference();
|
701
|
707
|
focus = new ColibriFocus(connection, config.hosts.bridge);
|
|
708
|
+ showRecordingButton(false);
|
702
|
709
|
}
|
703
|
710
|
if (connection.emuc.getPrezi(jid)) {
|
704
|
711
|
$(document).trigger('presentationremoved.muc',
|
|
@@ -867,6 +874,57 @@ function toggleAudio() {
|
867
|
874
|
buttonClick("#mute", "icon-microphone icon-mic-disabled");
|
868
|
875
|
}
|
869
|
876
|
|
|
877
|
+// Starts or stops the recording for the conference.
|
|
878
|
+function toggleRecording() {
|
|
879
|
+ if (focus === null || focus.confid === null) {
|
|
880
|
+ console.log('non-focus, or conference not yet organized: not enabling recording');
|
|
881
|
+ return;
|
|
882
|
+ }
|
|
883
|
+
|
|
884
|
+ if (!recordingToken)
|
|
885
|
+ {
|
|
886
|
+ $.prompt('<h2>Enter recording token</h2>' +
|
|
887
|
+ '<input id="recordingToken" type="text" placeholder="token" autofocus>',
|
|
888
|
+ {
|
|
889
|
+ persistent: false,
|
|
890
|
+ buttons: { "Save": true, "Cancel": false},
|
|
891
|
+ defaultButton: 1,
|
|
892
|
+ loaded: function (event) {
|
|
893
|
+ document.getElementById('recordingToken').focus();
|
|
894
|
+ },
|
|
895
|
+ submit: function (e, v, m, f) {
|
|
896
|
+ if (v) {
|
|
897
|
+ var token = document.getElementById('recordingToken');
|
|
898
|
+
|
|
899
|
+ if (token.value) {
|
|
900
|
+ setRecordingToken(Util.escapeHtml(token.value));
|
|
901
|
+ toggleRecording();
|
|
902
|
+ }
|
|
903
|
+ }
|
|
904
|
+ }
|
|
905
|
+ }
|
|
906
|
+ );
|
|
907
|
+
|
|
908
|
+ return;
|
|
909
|
+ }
|
|
910
|
+
|
|
911
|
+ var oldState = focus.recordingEnabled;
|
|
912
|
+ buttonClick("#recordButton", "icon-recEnable icon-recDisable");
|
|
913
|
+ focus.setRecording(!oldState,
|
|
914
|
+ recordingToken,
|
|
915
|
+ function (state) {
|
|
916
|
+ console.log("New recording state: ", state);
|
|
917
|
+ if (state == oldState) //failed to change, reset the token because it might have been wrong
|
|
918
|
+ {
|
|
919
|
+ buttonClick("#recordButton", "icon-recEnable icon-recDisable");
|
|
920
|
+ setRecordingToken(null);
|
|
921
|
+ }
|
|
922
|
+ }
|
|
923
|
+ );
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+}
|
|
927
|
+
|
870
|
928
|
/**
|
871
|
929
|
* Returns an array of the video horizontal and vertical indents,
|
872
|
930
|
* so that if fits its parent.
|
|
@@ -1111,6 +1169,10 @@ function setSharedKey(sKey) {
|
1111
|
1169
|
sharedKey = sKey;
|
1112
|
1170
|
}
|
1113
|
1171
|
|
|
1172
|
+function setRecordingToken(token) {
|
|
1173
|
+ recordingToken = token;
|
|
1174
|
+}
|
|
1175
|
+
|
1114
|
1176
|
/**
|
1115
|
1177
|
* Updates the room invite url.
|
1116
|
1178
|
*/
|
|
@@ -1171,6 +1233,20 @@ function setView(viewName) {
|
1171
|
1233
|
// }
|
1172
|
1234
|
}
|
1173
|
1235
|
|
|
1236
|
+function showRecordingButton(show) {
|
|
1237
|
+ if (!config.enableRecording) {
|
|
1238
|
+ return;
|
|
1239
|
+ }
|
|
1240
|
+
|
|
1241
|
+ if (show) {
|
|
1242
|
+ $('#recording').css({display: "inline"});
|
|
1243
|
+ }
|
|
1244
|
+ else {
|
|
1245
|
+ $('#recording').css({display: "none"});
|
|
1246
|
+ }
|
|
1247
|
+
|
|
1248
|
+}
|
|
1249
|
+
|
1174
|
1250
|
$(document).bind('fatalError.jingle',
|
1175
|
1251
|
function (event, session, error)
|
1176
|
1252
|
{
|