Просмотр исходного кода

Implements JitsiConnection

dev1
hristoterezov 10 лет назад
Родитель
Сommit
24975595b7

+ 0
- 149
Conference.js Просмотреть файл

@@ -1,149 +0,0 @@
1
-/**
2
- * Creates a Conference object with the given name and properties.
3
- * Note: this constructor is not a part of the public API (objects should be
4
- * created using Connection.createConference).
5
- * @param name name of the conference.
6
- * @param options Object with properties / settings related to the conference that will be created.
7
- * @param connection The Connection object for this Conference.
8
- * @constructor
9
- */
10
-
11
-function Conference(name, options, connection) {
12
-    
13
-}
14
-
15
-/**
16
- * Joins the conference.
17
- */
18
-Conference.prototype.join = function () {
19
-
20
-}
21
-
22
-/**
23
- * Leaves the conference.
24
- */
25
-Conference.prototype.leave = function () {
26
-
27
-}
28
-
29
-/**
30
- * Creates the media streams and returns them via the callback.
31
- * @param options Object with properties / settings defining which streams(Stream.AUDIO, Stream.VIDEO, Stream.DESKTOP)
32
- * should be created or some additional configurations about resolution for example.
33
- * @param successCallback callback that will receive the streams.
34
- * @param errorCallback callback that will be called if accessing the media streams fail.
35
- * @return an array of all created MediaStream-s
36
- */
37
-Conference.prototype.createMediaStreams = function (options, successCallback, errorCallback) {
38
-
39
-}
40
-
41
-/**
42
- * Attaches a handler for events(For example - "participant joined".) in the conference. All possible event are defined
43
- * in ConferenceEvents.
44
- * @param eventId the event ID.
45
- * @param handler handler for the event.
46
- */
47
-Conference.prototype.addEventListener = function (eventId, handler) {
48
-
49
-}
50
-
51
-/**
52
- * Removes event listener
53
- * @param eventId the event ID.
54
- */
55
-Conference.prototype.removeEventListener = function (eventId) {
56
-
57
-}
58
-
59
-/**
60
- * Receives notifications from another participants for commands / custom events(send by sendPresenceCommand method).
61
- * @param command {String} the name of the command
62
- * @param handler {Function} handler for the command
63
- */
64
-Conference.prototype.addPresenceCommandListener = function (command, handler) {
65
-
66
-}
67
-
68
-
69
-/**
70
- * Removes command  listener
71
- * @param command {String}  the name of the command
72
- */
73
-Conference.prototype.removePresenceCommandListener = function (command) {
74
-
75
-}
76
-
77
-/**
78
- * Sends local streams to the server side.
79
- * @param stream the stream object.
80
- * @param successCallback callback that will be called when the stream is sending is successfull.
81
- * @param errorCallback callback that will be called if something go wrong.
82
- */
83
-Conference.prototype.sendStream = function (stream, successCallback, errorCallback) {
84
-
85
-}
86
-
87
-/**
88
- * Sends text message to the other participants in the conference
89
- * @param message the text message.
90
- */
91
-Conference.prototype.sendTextMessage = function (message) {
92
-
93
-}
94
-
95
-/**
96
- * Send presence command.
97
- * @param name the name of the command.
98
- * @param values Object with keys and values that will be send.
99
- * @param persistent if false the command will be sent only one time
100
- * otherwise it will be sent with every system message sent to the other participants.
101
- * @param successCallback will be called when the command is successfully send.
102
- * @param errorCallback will be called when the command is not sent successfully.
103
- */
104
-Conference.prototype.sendPresenceCommand = function (name, values, persistent, successCallback, errorCallback) {
105
-
106
-}
107
-
108
-/**
109
- * Sets the display name for this conference.
110
- * @param name the display name to set
111
- */
112
-Conference.prototype.setDisplayName = function(name) {
113
-
114
-}
115
-
116
-/**
117
- * Start desktop sharing. This will replace the video stream with the desktop sharing stream.
118
- * @return Stream stream of type DESKTOP
119
- */
120
-Conference.prototype.startDesktopSharing = function() {
121
-
122
-}
123
-
124
-/**
125
- * Stop desktop sharing. This will replace the desktop stream with the video stream.
126
- * @return Stream stream of type VIDEO
127
- */
128
-Conference.prototype.endDesktopSharing = function() {
129
-
130
-}
131
-
132
-/**
133
- * Elects the participant with the given id to be the selected participant or the speaker.
134
- * @param id the identifier of the participant
135
- */
136
-Conference.prototype.selectParticipant = function(participantId) {
137
-
138
-}
139
-
140
-/**
141
- * Returns the list of participants for this conference.
142
- * @return Object a list of participant identifiers containing all conference participants.
143
- */
144
-Conference.prototype.getParticipants = function() {
145
-
146
-}
147
-
148
-
149
-module.exports = Conference;

+ 0
- 52
Connection.js Просмотреть файл

@@ -1,52 +0,0 @@
1
-var Conference = require("./Conference");
2
-
3
-/**
4
- * Creates new connection object for the Jitsi Meet server side video conferencing service. Provides access to the
5
- * Conference interface.
6
- * @param appID identification for the provider of Jitsi Meet video conferencing services.
7
- * @param token secret generated by the provider of Jitsi Meet video conferencing services.
8
- * The token will be send to the provider from the Jitsi Meet server deployment for authorization of the current client.
9
- * @param options Object with properties / settings related to connection with the server.
10
- * @constructor
11
- */
12
-function Connection(appID, token, options) {
13
-
14
-}
15
-
16
-/**
17
- * Connect the client with the server.
18
- * @param successCallback this callback will be called when the connection is successfull
19
- * @param errorCallback this callback will be called when the connection fail.
20
- */
21
-Connection.prototype.connect = function (successCallback, errorCallback) {
22
-
23
-}
24
-
25
-/**
26
- * Disconnect the client from the server.
27
- * @param successCallback this callback will be called when we have successfully disconnected
28
- * @param errorCallback this callback will be called when the disconnect didn't succeed
29
- */
30
-Connection.prototype.disconnect = function (successCallback, errorCallback) {
31
-
32
-}
33
-
34
-/**
35
- * This method allows renewal of the tokens if they are expiring.
36
- * @param token the new token.
37
- */
38
-Connection.prototype.setToken = function (token) {
39
-
40
-}
41
-
42
-/**
43
- * Creates and joins new conference.
44
- * @param name the name of the conference; if null - a generated name will be provided from the api
45
- * @param options Object with properties / settings related to the conference that will be created.
46
- * @returns {Conference} returns the new conference object.
47
- */
48
-Connection.prototype.initConference = function (name, options) {
49
-    return new Conference(name, options, this);
50
-}
51
-
52
-module.exports = Connection;

+ 140
- 0
JitsiConference.js Просмотреть файл

@@ -0,0 +1,140 @@
1
+var xmpp = require("./modules/xmpp/xmpp");
2
+/**
3
+ * Creates a JitsiConference object with the given name and properties.
4
+ * Note: this constructor is not a part of the public API (objects should be
5
+ * created using JitsiConnection.createConference).
6
+ * @param options.config properties / settings related to the conference that will be created.
7
+ * @param options.name the name of the conference
8
+ * @param options.connection the JitsiConnection object for this JitsiConference.
9
+ * @constructor
10
+ */
11
+
12
+function JitsiConference(options) {
13
+   this.options = options;
14
+}
15
+
16
+/**
17
+ * Joins the conference.
18
+ */
19
+JitsiConference.prototype.join = function () {
20
+    xmpp.joinRoom(this.options.name, null, null);
21
+}
22
+
23
+/**
24
+ * Leaves the conference.
25
+ */
26
+JitsiConference.prototype.leave = function () {
27
+    xmpp.l
28
+}
29
+
30
+/**
31
+ * Creates the media tracks and returns them via the callback.
32
+ * @param options Object with properties / settings specifying the tracks which should be created.
33
+ * should be created or some additional configurations about resolution for example.
34
+ * @returns {Promise.<{Array.<JitsiTrack>}, JitsiConferenceError>} A promise that returns an array of created JitsiTracks if resolved,
35
+ *     or a JitsiConferenceError if rejected.
36
+ */
37
+JitsiConference.prototype.createLocalTracks = function (options) {
38
+
39
+}
40
+
41
+/**
42
+ * Returns the local tracks.
43
+ */
44
+JitsiConference.prototype.getLocalTracks = function () {
45
+
46
+};
47
+
48
+
49
+/**
50
+ * Attaches a handler for events(For example - "participant joined".) in the conference. All possible event are defined
51
+ * in JitsiConferenceEvents.
52
+ * @param eventId the event ID.
53
+ * @param handler handler for the event.
54
+ *
55
+ * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
56
+ */
57
+JitsiConference.prototype.on = function (eventId, handler) {
58
+
59
+}
60
+
61
+/**
62
+ * Removes event listener
63
+ * @param eventId the event ID.
64
+ * @param [handler] optional, the specific handler to unbind
65
+ *
66
+ * Note: consider adding eventing functionality by extending an EventEmitter impl, instead of rolling ourselves
67
+ */
68
+JitsiConference.prototype.off = function (eventId, handler) {
69
+
70
+}
71
+
72
+// Common aliases for event emitter
73
+JitsiConference.prototype.addEventListener = JitsiConference.prototype.on
74
+JitsiConference.prototype.removeEventListener = JitsiConference.prototype.off
75
+
76
+/**
77
+ * Receives notifications from another participants for commands / custom events(send by sendPresenceCommand method).
78
+ * @param command {String} the name of the command
79
+ * @param handler {Function} handler for the command
80
+ */
81
+ JitsiConference.prototype.addCommandListener = function (command, handler) {
82
+
83
+ }
84
+
85
+/**
86
+  * Removes command  listener
87
+  * @param command {String}  the name of the command
88
+  */
89
+ JitsiConference.prototype.removeCommandListener = function (command) {
90
+
91
+ }
92
+
93
+/**
94
+ * Sends text message to the other participants in the conference
95
+ * @param message the text message.
96
+ */
97
+JitsiConference.prototype.sendTextMessage = function (message) {
98
+
99
+}
100
+
101
+/**
102
+ * Send presence command.
103
+ * @param name the name of the command.
104
+ * @param values Object with keys and values that will be send.
105
+ * @param persistent if false the command will be sent only one time
106
+ * @param successCallback will be called when the command is successfully send.
107
+ * @param errorCallback will be called when the command is not sent successfully.
108
+ * @returns {Promise.<{void}, JitsiConferenceError>} A promise that returns an array of created streams if resolved,
109
+ *     or an JitsiConferenceError if rejected.
110
+ */
111
+JitsiConference.prototype.sendCommand = function (name, values, persistent) {
112
+
113
+}
114
+
115
+/**
116
+ * Sets the display name for this conference.
117
+ * @param name the display name to set
118
+ */
119
+JitsiConference.prototype.setDisplayName = function(name) {
120
+
121
+}
122
+
123
+/**
124
+ * Elects the participant with the given id to be the selected participant or the speaker.
125
+ * @param id the identifier of the participant
126
+ */
127
+JitsiConference.prototype.selectParticipant = function(participantId) {
128
+
129
+}
130
+
131
+/**
132
+ * Returns the list of participants for this conference.
133
+ * @return Object a list of participant identifiers containing all conference participants.
134
+ */
135
+JitsiConference.prototype.getParticipants = function() {
136
+
137
+}
138
+
139
+
140
+module.exports = JitsiConference;

ConferenceErrors.js → JitsiConferenceErrors.js Просмотреть файл

@@ -1,8 +1,8 @@
1 1
 /**
2
- * Enumeration with the erros for the conference.
2
+ * Enumeration with the errors for the conference.
3 3
  * @type {{string: string}}
4 4
  */
5
-var ConferenceErrors = {
5
+var JitsiConferenceErrors = {
6 6
     /**
7 7
      * Indicates that a password is required in order to join the conference.
8 8
      */
@@ -12,12 +12,12 @@ var ConferenceErrors = {
12 12
      */
13 13
     CONNECTION_ERROR: "conference.connectionError",
14 14
     /**
15
-     * Indicates that the video bridge is down.
15
+     * Indicates that there is no available videobridge.
16 16
      */
17
-    BRIDGE_DOWN: "conference.bridgeDown"
17
+    VIDEOBRIDGE_NOT_AVAILABLE: "conference.videobridgeNotAvailable"
18 18
     /**
19 19
      * Many more errors TBD here.
20 20
      */
21 21
 };
22 22
 
23
-module.exports = ConferenceErrors;
23
+module.exports = JitsiConferenceErrors;

ConferenceEvents.js → JitsiConferenceEvents.js Просмотреть файл

@@ -2,15 +2,15 @@
2 2
  * Enumeration with the events for the conference.
3 3
  * @type {{string: string}}
4 4
  */
5
-var ConferenceEvents = {
5
+var JitsiConferenceEvents = {
6 6
     /**
7
-     * New media stream was added to the conference.
7
+     * A new media track was added to the conference.
8 8
      */
9
-    STREAM_ADDED: "conference.streamAdded",
9
+    TRACK_ADDED: "conference.trackAdded",
10 10
     /**
11
-     * The media stream was removed to the conference.
11
+     * The media track was removed to the conference.
12 12
      */
13
-    STREAM_REMOVED: "conference.streamRemoved",
13
+    TRACK_REMOVED: "conference.trackRemoved",
14 14
     /**
15 15
      * The active speaker was changed.
16 16
      */
@@ -44,17 +44,17 @@ var ConferenceEvents = {
44 44
      */
45 45
     LAST_N_CHANGED: "conference.lastNChanged",
46 46
     /**
47
-     * Stream was muted.
47
+     * A media track was muted.
48 48
      */
49
-    STREAM_MUTED: "conference.streamMuted",
49
+    TRACK_MUTED: "conference.trackMuted",
50 50
     /**
51
-     * Stream was unmuted.
51
+     * A media track was unmuted.
52 52
      */
53
-    STREAM_UNMUTED: "conference.streamUnmuted",
53
+    TRACK_UNMUTED: "conference.trackUnmuted",
54 54
     /**
55
-     * Audio levels of a stream was changed.
55
+     * Audio levels of a media track was changed.
56 56
      */
57
-    STREAM_AUDIO_LEVEL_CHANGED: "conference.audioLevelsChanged",
57
+    TRACK_AUDIO_LEVEL_CHANGED: "conference.audioLevelsChanged",
58 58
     /**
59 59
      * Indicates that the connection to the conference has been interrupted for some reason.
60 60
      */
@@ -62,7 +62,7 @@ var ConferenceEvents = {
62 62
     /**
63 63
      * Indicates that the connection to the conference has been restored.
64 64
      */
65
-    CONNECTION_RESTORED: "conference.connecionRestored"
65
+    CONNECTION_ESTABLISHED: "conference.connecionEstablished"
66 66
 };
67 67
 
68
-module.exports = ConferenceEvents;
68
+module.exports = JitsiConferenceEvents;

+ 73
- 0
JitsiConnection.js Просмотреть файл

@@ -0,0 +1,73 @@
1
+var JitsiConference = require("./JitsiConference");
2
+var XMPP = require("./modules/xmpp/xmpp");
3
+
4
+/**
5
+ * Creates new connection object for the Jitsi Meet server side video conferencing service. Provides access to the
6
+ * JitsiConference interface.
7
+ * @param appID identification for the provider of Jitsi Meet video conferencing services.
8
+ * @param token secret generated by the provider of Jitsi Meet video conferencing services.
9
+ * The token will be send to the provider from the Jitsi Meet server deployment for authorization of the current client.
10
+ * @param options Object with properties / settings related to connection with the server.
11
+ * @constructor
12
+ */
13
+function JitsiConnection(appID, token, options) {
14
+    this.appID = appID;
15
+    this.token = token;
16
+    this.options = options;
17
+    this.xmpp = new XMPP(options);
18
+}
19
+
20
+/**
21
+ * Connect the client with the server.
22
+ * @param options {object} connecting options (for example authentications parameters).
23
+ */
24
+JitsiConnection.prototype.connect = function (options) {
25
+    if(!options)
26
+        options = {};
27
+    this.xmpp.connect(options.id, options.password);
28
+}
29
+
30
+/**
31
+ * Disconnect the client from the server.
32
+ */
33
+JitsiConnection.prototype.disconnect = function () {
34
+    this.xmpp.disconnect();
35
+}
36
+
37
+/**
38
+ * This method allows renewal of the tokens if they are expiring.
39
+ * @param token the new token.
40
+ */
41
+JitsiConnection.prototype.setToken = function (token) {
42
+    this.token = token;
43
+}
44
+
45
+/**
46
+ * Creates and joins new conference.
47
+ * @param name the name of the conference; if null - a generated name will be provided from the api
48
+ * @param options Object with properties / settings related to the conference that will be created.
49
+ * @returns {JitsiConference} returns the new conference object.
50
+ */
51
+JitsiConnection.prototype.initJitsiConference = function (name, options) {
52
+    return new JitsiConference({name: name, config: options, connection: this});
53
+}
54
+
55
+/**
56
+ * Subscribes the passed listener to the event.
57
+ * @param event {JitsiConnectionEvents} the connection event.
58
+ * @param listener {Function} the function that will receive the event
59
+ */
60
+JitsiConnection.prototype.addListener = function (event, listener) {
61
+    this.xmpp.addListener(event, listener);
62
+}
63
+
64
+/**
65
+ * Unsubscribes the passed handler.
66
+ * @param event {JitsiConnectionEvents} the connection event.
67
+ * @param listener {Function} the function that will receive the event
68
+ */
69
+JitsiConnection.prototype.removeListener = function (event, listener) {
70
+    this.xmpp.removeListener(event, listener);
71
+}
72
+
73
+module.exports = JitsiConnection;

+ 20
- 0
JitsiConnectionErrors.js Просмотреть файл

@@ -0,0 +1,20 @@
1
+/**
2
+ * Enumeration with the errors for the connection.
3
+ * @type {{string: string}}
4
+ */
5
+var JitsiConnectionErrors = {
6
+    /**
7
+     * Indicates that a password is required in order to join the conference.
8
+     */
9
+    PASSWORD_REQUIRED: "connection.passwordRequired",
10
+    /**
11
+     * Indicates that a connection error occurred when trying to join a conference.
12
+     */
13
+    CONNECTION_ERROR: "connection.connectionError",
14
+    /**
15
+     * Not specified errors.
16
+     */
17
+    OTHER_ERROR: "connection.otherError"
18
+};
19
+
20
+module.exports = JitsiConnectionErrors;

+ 25
- 0
JitsiConnectionEvents.js Просмотреть файл

@@ -0,0 +1,25 @@
1
+/**
2
+ * Enumeration with the events for the connection.
3
+ * @type {{string: string}}
4
+ */
5
+var JitsiConnnectionEvents = {
6
+    /**
7
+     * Indicates that the connection has been failed for some reason.
8
+     */
9
+    CONNECTION_FAILED: "connection.connecionFailed",
10
+    /**
11
+     * Indicates that the connection has been established.
12
+     */
13
+    CONNECTION_ESTABLISHED: "connection.connecionEstablished",
14
+    /**
15
+     * Indicates that the connection has been disconnected.
16
+     */
17
+    CONNECTION_DISCONNECTED: "connection.connecionDisconnected",
18
+    /**
19
+     * Indicates that the perfomed action cannot be executed because the
20
+     * connection is not in the correct state(connected, disconnected, etc.)
21
+     */
22
+    WRONG_STATE: "connection.wrongState"
23
+};
24
+
25
+module.exports = JitsiConnnectionEvents;

+ 15
- 4
JitsiMeetJS.js Просмотреть файл

@@ -1,16 +1,27 @@
1
-var Connection = require("./Connection");
2
-var ConferenceEvents = require("./ConferenceEvents");
1
+var JitsiConnection = require("./JitsiConnection");
2
+var JitsiConferenceEvents = require("./JitsiConferenceEvents");
3
+var JitsiConnectionEvents = require("./JitsiConnectionEvents");
4
+var JitsiConnectionErrors = require("./JitsiConnectionErrors");
5
+var JitsiConferenceErrors = require("./JitsiConferenceErrors");
3 6
 
4 7
 /**
5 8
  * Namespace for the interface of Jitsi Meet Library.
6 9
  */
7 10
 var LibJitsiMeet = {
8 11
 
9
-    Connection: Connection,
12
+    JitsiConnection: JitsiConnection,
10 13
     events: {
11
-        conference: ConferenceEvents
14
+        conference: JitsiConferenceEvents,
15
+        connection: JitsiConnectionEvents
16
+    },
17
+    errors: {
18
+        conference: JitsiConferenceErrors,
19
+        connection: JitsiConnectionErrors
12 20
     }
13 21
 
14 22
 }
15 23
 
24
+//Setups the promise object.
25
+require("es6-promise").polyfill();
26
+
16 27
 module.exports = LibJitsiMeet;

+ 95
- 0
JitsiTrack.js Просмотреть файл

@@ -0,0 +1,95 @@
1
+/**
2
+ * Represents a single media track (either audio or video).
3
+ * @constructor
4
+ */
5
+function JitsiTrack()
6
+{
7
+
8
+}
9
+
10
+/**
11
+ * JitsiTrack video type.
12
+ * @type {string}
13
+ */
14
+JitsiTrack.VIDEO = "video";
15
+
16
+/**
17
+ * JitsiTrack audio type.
18
+ * @type {string}
19
+ */
20
+JitsiTrack.AUDIO = "audio";
21
+
22
+/**
23
+ * Returns the type (audio or video) of this track.
24
+ */
25
+JitsiTrack.prototype.getType = function() {
26
+};
27
+
28
+/**
29
+ * Returns the JitsiParticipant to which this track belongs, or null if it is a local track.
30
+ */
31
+JitsiTrack.prototype.getParitcipant() = function() {
32
+
33
+};
34
+
35
+/**
36
+ * Returns the RTCMediaStream from the browser (?).
37
+ */
38
+JitsiTrack.prototype.getOriginalStream() {
39
+
40
+}
41
+
42
+/**
43
+ * Mutes the track.
44
+ */
45
+JitsiTrack.prototype.mute = function () {
46
+
47
+}
48
+
49
+/**
50
+ * Unmutes the stream.
51
+ */
52
+JitsiTrack.prototype.unmute = function () {
53
+
54
+}
55
+
56
+/**
57
+ * Attaches the MediaStream of this track to an HTML container (?).
58
+ * @param container the HTML container
59
+ */
60
+JitsiTrack.prototype.attach = function (container) {
61
+
62
+}
63
+
64
+/**
65
+ * Removes the track from the passed HTML container.
66
+ * @param container the HTML container
67
+ */
68
+JitsiTrack.prototype.detach = function (container) {
69
+
70
+}
71
+
72
+/**
73
+ * Stops sending the media track. And removes it from the HTML.
74
+ * NOTE: Works for local tracks only.
75
+ */
76
+JitsiTrack.prototype.stop = function () {
77
+
78
+}
79
+
80
+
81
+/**
82
+ * Starts sending the track.
83
+ * NOTE: Works for local tracks only.
84
+ */
85
+JitsiTrack.prototype.start = function() {
86
+}
87
+
88
+/**
89
+ * Returns true if this is a video track and the source of the video is a
90
+ * screen capture as opposed to a camera.
91
+ */
92
+JitsiTrack.prototype.isScreenSharing = function(){
93
+}
94
+
95
+module.exports = JitsiTrack;

+ 7
- 9
Makefile Просмотреть файл

@@ -1,27 +1,25 @@
1
-NPM = npm
2 1
 BROWSERIFY = browserify
3
-GLOBAL_FLAGS = -x jquery -e
2
+GLOBAL_FLAGS =
4 3
 OUTPUT_DIR = .
5
-DEPLOY_DIR = libs
4
+DEPLOY_DIR = ../../jitsi-meet
6 5
 
7
-all: compile deploy clean
6
+all: compile deploy
8 7
 
9 8
 compile:FLAGS = $(GLOBAL_FLAGS)
10 9
 compile: app
11 10
 
12
-debug: compile-debug deploy clean
11
+debug: compile-debug deploy
13 12
 
14 13
 compile-debug:FLAGS = -d $(GLOBAL_FLAGS)
15 14
 compile-debug: app
16 15
 
17 16
 app:
18
-	$(NPM) update && $(BROWSERIFY) $(FLAGS) app.js -s APP -o $(OUTPUT_DIR)/app.bundle.js
17
+	$(BROWSERIFY) $(FLAGS) JitsiMeetJS.js -s JitsiMeetJS -o $(OUTPUT_DIR)/lib-jitsi-meet.js
19 18
 
20 19
 clean:
21
-	rm -f $(OUTPUT_DIR)/*.bundle.js
20
+	rm -f $(OUTPUT_DIR)/lib-jitsi-meet.js
22 21
 
23 22
 deploy:
24 23
 	mkdir -p $(DEPLOY_DIR) && \
25
-	cp $(OUTPUT_DIR)/*.bundle.js $(DEPLOY_DIR) && \
26
-	./bump-js-versions.sh && \
24
+	cp $(OUTPUT_DIR)/lib-jitsi-meet.js $(DEPLOY_DIR) && \
27 25
 	([ ! -x deploy-local.sh ] || ./deploy-local.sh)

+ 0
- 81
Stream.js Просмотреть файл

@@ -1,81 +0,0 @@
1
-/**
2
- * Represents media stream(audio, video, desktop)
3
- * @constructor
4
- */
5
-function Stream()
6
-{
7
-
8
-}
9
-
10
-/**
11
- * Stream video type.
12
- * @type {string}
13
- */
14
-Stream.VIDEO = "video";
15
-
16
-/**
17
- * Stream audio type.
18
- * @type {string}
19
- */
20
-Stream.AUDIO = "audio";
21
-
22
-/**
23
- * Stream desktop sharing type.
24
- * @type {string}
25
- */
26
-Stream.DESKTOP_SHARING = "desktopsharing";
27
-
28
-/**
29
- * The media stream type.
30
- */
31
-Stream.prototype.streamType;
32
-
33
-/**
34
- * The corresponding participant identifier.
35
- */
36
-Stream.prototype.participantId;
37
-
38
-/**
39
- * The media stream from the browser.
40
- */
41
-Stream.prototype.originalStream;
42
-
43
-/**
44
- * Mutes the stream.
45
- */
46
-Stream.prototype.mute = function () {
47
-
48
-}
49
-
50
-/**
51
- * Unmutes the stream.
52
- */
53
-Stream.prototype.unmute = function () {
54
-
55
-}
56
-
57
-/**
58
- * Attaches the stream to HTML container.
59
- * @param container the HTML container
60
- */
61
-Stream.prototype.attachStream = function (container) {
62
-
63
-}
64
-
65
-/**
66
- * Removes the stream from the passed HTML container.
67
- * @param container the HTML container
68
- */
69
-Stream.prototype.remove = function (container) {
70
-
71
-}
72
-
73
-/**
74
- * Stops sending the stream. And removes it from the HTML.
75
- * NOTE: Works for the local stream only.
76
- */
77
-Stream.prototype.stop = function () {
78
-
79
-}
80
-
81
-module.exports = Stream;

+ 12504
- 0
lib-jitsi-meet.js
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 7
- 2
modules/RTC/RTCUtils.js Просмотреть файл

@@ -134,8 +134,8 @@ function getConstraints(um, resolution, bandwidth, fps, desktopStream, isAndroid
134 134
     return constraints;
135 135
 }
136 136
 
137
-
138
-function RTCUtils(RTCService, onTemasysPluginReady)
137
+//Options parameter is to pass config options. Currently uses only "useIPv6".
138
+function RTCUtils(RTCService, onTemasysPluginReady, options)
139 139
 {
140 140
     var self = this;
141 141
     this.service = RTCService;
@@ -209,6 +209,10 @@ function RTCUtils(RTCService, onTemasysPluginReady)
209 209
         };
210 210
         // DTLS should now be enabled by default but..
211 211
         this.pc_constraints = {'optional': [{'DtlsSrtpKeyAgreement': 'true'}]};
212
+        if (options.useIPv6) {
213
+            // https://code.google.com/p/webrtc/issues/detail?id=2828
214
+            this.pc_constraints.optional.push({googIPv6: true});
215
+        }
212 216
         if (navigator.userAgent.indexOf('Android') != -1) {
213 217
             this.pc_constraints = {}; // disable DTLS on Android
214 218
         }
@@ -279,6 +283,7 @@ function RTCUtils(RTCService, onTemasysPluginReady)
279 283
         } catch (e) { }
280 284
         window.location.href = 'unsupported_browser.html';
281 285
     }
286
+
282 287
 }
283 288
 
284 289
 

+ 1
- 2
modules/xmpp/JingleSessionPC.js Просмотреть файл

@@ -20,7 +20,6 @@ function JingleSessionPC(me, sid, connection, service, eventEmitter) {
20 20
     this.localSDP = null;
21 21
     this.remoteSDP = null;
22 22
     this.relayedStreams = [];
23
-    this.pc_constraints = null;
24 23
 
25 24
     this.usetrickle = true;
26 25
     this.usepranswer = false; // early transport warmup -- mind you, this might fail. depends on webrtc issue 1718
@@ -87,7 +86,7 @@ JingleSessionPC.prototype.doInitialize = function () {
87 86
 
88 87
     this.peerconnection = new TraceablePeerConnection(
89 88
             this.connection.jingle.ice_config,
90
-            this.connection.jingle.pc_constraints,
89
+            APP.RTC.getPCConstraints(),
91 90
             this);
92 91
 
93 92
     this.peerconnection.onicecandidate = function (event) {

+ 22
- 21
modules/xmpp/moderator.js Просмотреть файл

@@ -35,7 +35,7 @@ var externalAuthEnabled = false;
35 35
 // Sip gateway can be enabled by configuring Jigasi host in config.js or
36 36
 // it will be enabled automatically if focus detects the component through
37 37
 // service discovery.
38
-var sipGatewayEnabled = config.hosts.call_control !== undefined;
38
+var sipGatewayEnabled = null;
39 39
 
40 40
 var eventEmitter = null;
41 41
 
@@ -63,6 +63,7 @@ var Moderator = {
63 63
 
64 64
     init: function (xmpp, emitter) {
65 65
         this.xmppService = xmpp;
66
+        sipGatewayEnabled = this.xmppService.options.hosts.call_control !== undefined;
66 67
         eventEmitter = emitter;
67 68
 
68 69
         // Message listener that talks to POPUP window
@@ -111,10 +112,10 @@ var Moderator = {
111 112
 
112 113
     getFocusComponent: function () {
113 114
         // Get focus component address
114
-        var focusComponent = config.hosts.focus;
115
+        var focusComponent = this.xmppService.options.hosts.focus;
115 116
         // If not specified use default: 'focus.domain'
116 117
         if (!focusComponent) {
117
-            focusComponent = 'focus.' + config.hosts.domain;
118
+            focusComponent = 'focus.' + this.xmppService.options.hosts.domain;
118 119
         }
119 120
         return focusComponent;
120 121
     },
@@ -140,55 +141,55 @@ var Moderator = {
140 141
             elem.attrs({ 'session-id': sessionId});
141 142
         }
142 143
 
143
-        if (config.hosts.bridge !== undefined) {
144
+        if (this.xmppService.options.hosts.bridge !== undefined) {
144 145
             elem.c(
145 146
                 'property',
146
-                { name: 'bridge', value: config.hosts.bridge})
147
+                { name: 'bridge', value: this.xmppService.options.hosts.bridge})
147 148
                 .up();
148 149
         }
149 150
         // Tell the focus we have Jigasi configured
150
-        if (config.hosts.call_control !== undefined) {
151
+        if (this.xmppService.options.hosts.call_control !== undefined) {
151 152
             elem.c(
152 153
                 'property',
153
-                { name: 'call_control', value: config.hosts.call_control})
154
+                { name: 'call_control', value: this.xmppService.options.hosts.call_control})
154 155
                 .up();
155 156
         }
156
-        if (config.channelLastN !== undefined) {
157
+        if (this.xmppService.options.channelLastN !== undefined) {
157 158
             elem.c(
158 159
                 'property',
159
-                { name: 'channelLastN', value: config.channelLastN})
160
+                { name: 'channelLastN', value: this.xmppService.options.channelLastN})
160 161
                 .up();
161 162
         }
162
-        if (config.adaptiveLastN !== undefined) {
163
+        if (this.xmppService.options.adaptiveLastN !== undefined) {
163 164
             elem.c(
164 165
                 'property',
165
-                { name: 'adaptiveLastN', value: config.adaptiveLastN})
166
+                { name: 'adaptiveLastN', value: this.xmppService.options.adaptiveLastN})
166 167
                 .up();
167 168
         }
168
-        if (config.adaptiveSimulcast !== undefined) {
169
+        if (this.xmppService.options.adaptiveSimulcast !== undefined) {
169 170
             elem.c(
170 171
                 'property',
171
-                { name: 'adaptiveSimulcast', value: config.adaptiveSimulcast})
172
+                { name: 'adaptiveSimulcast', value: this.xmppService.options.adaptiveSimulcast})
172 173
                 .up();
173 174
         }
174
-        if (config.openSctp !== undefined) {
175
+        if (this.xmppService.options.openSctp !== undefined) {
175 176
             elem.c(
176 177
                 'property',
177
-                { name: 'openSctp', value: config.openSctp})
178
+                { name: 'openSctp', value: this.xmppService.options.openSctp})
178 179
                 .up();
179 180
         }
180
-        if(config.startAudioMuted !== undefined)
181
+        if(this.xmppService.options.startAudioMuted !== undefined)
181 182
         {
182 183
             elem.c(
183 184
                 'property',
184
-                { name: 'startAudioMuted', value: config.startAudioMuted})
185
+                { name: 'startAudioMuted', value: this.xmppService.options.startAudioMuted})
185 186
                 .up();
186 187
         }
187
-        if(config.startVideoMuted !== undefined)
188
+        if(this.xmppService.options.startVideoMuted !== undefined)
188 189
         {
189 190
             elem.c(
190 191
                 'property',
191
-                { name: 'startVideoMuted', value: config.startVideoMuted})
192
+                { name: 'startVideoMuted', value: this.xmppService.options.startVideoMuted})
192 193
                 .up();
193 194
         }
194 195
         elem.c(
@@ -250,7 +251,7 @@ var Moderator = {
250 251
     // to the user(or that focus is not available)
251 252
     allocateConferenceFocus: function (roomName, callback) {
252 253
         // Try to use focus user JID from the config
253
-        Moderator.setFocusUserJid(config.focusUserJid);
254
+        Moderator.setFocusUserJid(this.xmppService.options.focusUserJid);
254 255
         // Send create conference IQ
255 256
         var iq = Moderator.createConferenceIq(roomName);
256 257
         var self = this;
@@ -310,7 +311,7 @@ var Moderator = {
310 311
                     console.warn("Unauthorized to start the conference", error);
311 312
                     var toDomain
312 313
                         = Strophe.getDomainFromJid(error.getAttribute('to'));
313
-                    if (toDomain !== config.hosts.anonymousdomain) {
314
+                    if (toDomain !== this.xmppService.options.hosts.anonymousdomain) {
314 315
                         // FIXME: "is external" should come either from
315 316
                         // the focus or config.js
316 317
                         externalAuthEnabled = true;

+ 0
- 169
modules/xmpp/recording.js Просмотреть файл

@@ -1,169 +0,0 @@
1
-/* global $, $iq, config, connection, focusMucJid, messageHandler,
2
-   Toolbar, Util */
3
-var Moderator = require("./moderator");
4
-
5
-
6
-var recordingToken = null;
7
-var recordingEnabled;
8
-
9
-/**
10
- * Whether to use a jirecon component for recording, or use the videobridge
11
- * through COLIBRI.
12
- */
13
-var useJirecon = (typeof config.hosts.jirecon != "undefined");
14
-
15
-/**
16
- * The ID of the jirecon recording session. Jirecon generates it when we
17
- * initially start recording, and it needs to be used in subsequent requests
18
- * to jirecon.
19
- */
20
-var jireconRid = null;
21
-
22
-/**
23
- * The callback to update the recording button. Currently used from colibri
24
- * after receiving a pending status.
25
- */
26
-var recordingStateChangeCallback = null;
27
-
28
-function setRecordingToken(token) {
29
-    recordingToken = token;
30
-}
31
-
32
-function setRecordingJirecon(state, token, callback, connection) {
33
-    if (state == recordingEnabled){
34
-        return;
35
-    }
36
-
37
-    var iq = $iq({to: config.hosts.jirecon, type: 'set'})
38
-        .c('recording', {xmlns: 'http://jitsi.org/protocol/jirecon',
39
-            action: (state === 'on') ? 'start' : 'stop',
40
-            mucjid: connection.emuc.roomjid});
41
-    if (state === 'off'){
42
-        iq.attrs({rid: jireconRid});
43
-    }
44
-
45
-    console.log('Start recording');
46
-
47
-    connection.sendIQ(
48
-        iq,
49
-        function (result) {
50
-            // TODO wait for an IQ with the real status, since this is
51
-            // provisional?
52
-            jireconRid = $(result).find('recording').attr('rid');
53
-            console.log('Recording ' + ((state === 'on') ? 'started' : 'stopped') +
54
-                '(jirecon)' + result);
55
-            recordingEnabled = state;
56
-            if (state === 'off'){
57
-                jireconRid = null;
58
-            }
59
-
60
-            callback(state);
61
-        },
62
-        function (error) {
63
-            console.log('Failed to start recording, error: ', error);
64
-            callback(recordingEnabled);
65
-        });
66
-}
67
-
68
-// Sends a COLIBRI message which enables or disables (according to 'state')
69
-// the recording on the bridge. Waits for the result IQ and calls 'callback'
70
-// with the new recording state, according to the IQ.
71
-function setRecordingColibri(state, token, callback, connection) {
72
-    var elem = $iq({to: connection.emuc.focusMucJid, type: 'set'});
73
-    elem.c('conference', {
74
-        xmlns: 'http://jitsi.org/protocol/colibri'
75
-    });
76
-    elem.c('recording', {state: state, token: token});
77
-
78
-    connection.sendIQ(elem,
79
-        function (result) {
80
-            console.log('Set recording "', state, '". Result:', result);
81
-            var recordingElem = $(result).find('>conference>recording');
82
-            var newState = recordingElem.attr('state');
83
-
84
-            recordingEnabled = newState;
85
-            callback(newState);
86
-
87
-            if (newState === 'pending' && recordingStateChangeCallback == null) {
88
-                recordingStateChangeCallback = callback;
89
-                connection.addHandler(function(iq){
90
-                    var state = $(iq).find('recording').attr('state');
91
-                    if (state)
92
-                        recordingStateChangeCallback(state);
93
-                }, 'http://jitsi.org/protocol/colibri', 'iq', null, null, null);
94
-            }
95
-        },
96
-        function (error) {
97
-            console.warn(error);
98
-            callback(recordingEnabled);
99
-        }
100
-    );
101
-}
102
-
103
-function setRecording(state, token, callback, connection) {
104
-    if (useJirecon){
105
-        setRecordingJirecon(state, token, callback, connection);
106
-    } else {
107
-        setRecordingColibri(state, token, callback, connection);
108
-    }
109
-}
110
-
111
-var Recording = {
112
-    toggleRecording: function (tokenEmptyCallback, recordingStateChangeCallback, connection) {
113
-        if (!Moderator.isModerator()) {
114
-            console.log(
115
-                    'non-focus, or conference not yet organized:' +
116
-                    ' not enabling recording');
117
-            return;
118
-        }
119
-
120
-        var self = this;
121
-        // Jirecon does not (currently) support a token.
122
-        if (!recordingToken && !useJirecon) {
123
-            tokenEmptyCallback(function (value) {
124
-                setRecordingToken(value);
125
-                self.toggleRecording(tokenEmptyCallback, recordingStateChangeCallback, connection);
126
-            });
127
-
128
-            return;
129
-        }
130
-
131
-        var oldState = recordingEnabled;
132
-        var newState = (oldState === 'off' || !oldState) ? 'on' : 'off';
133
-
134
-        setRecording(newState,
135
-            recordingToken,
136
-            function (state) {
137
-                console.log("New recording state: ", state);
138
-                if (state === oldState) {
139
-                    // FIXME: new focus:
140
-                    // this will not work when moderator changes
141
-                    // during active session. Then it will assume that
142
-                    // recording status has changed to true, but it might have
143
-                    // been already true(and we only received actual status from
144
-                    // the focus).
145
-                    //
146
-                    // SO we start with status null, so that it is initialized
147
-                    // here and will fail only after second click, so if invalid
148
-                    // token was used we have to press the button twice before
149
-                    // current status will be fetched and token will be reset.
150
-                    //
151
-                    // Reliable way would be to return authentication error.
152
-                    // Or status update when moderator connects.
153
-                    // Or we have to stop recording session when current
154
-                    // moderator leaves the room.
155
-
156
-                    // Failed to change, reset the token because it might
157
-                    // have been wrong
158
-                    setRecordingToken(null);
159
-                }
160
-                recordingStateChangeCallback(state);
161
-
162
-            },
163
-            connection
164
-        );
165
-    }
166
-
167
-};
168
-
169
-module.exports = Recording;

+ 3
- 3
modules/xmpp/strophe.emuc.js Просмотреть файл

@@ -321,7 +321,7 @@ module.exports = function(XMPP, eventEmitter) {
321 321
             } else if ($(pres).find(
322 322
                 '>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
323 323
                 var toDomain = Strophe.getDomainFromJid(pres.getAttribute('to'));
324
-                if (toDomain === config.hosts.anonymousdomain) {
324
+                if (toDomain === XMPP.options.hosts.anonymousdomain) {
325 325
                     // enter the room by replying with 'not-authorized'. This would
326 326
                     // result in reconnection from authorized domain.
327 327
                     // We're either missing Jicofo/Prosody config for anonymous
@@ -452,7 +452,7 @@ module.exports = function(XMPP, eventEmitter) {
452 452
 
453 453
             // Send XEP-0115 'c' stanza that contains our capabilities info
454 454
             if (this.connection.caps) {
455
-                this.connection.caps.node = config.clientNode;
455
+                this.connection.caps.node = XMPP.options.clientNode;
456 456
                 pres.c('c', this.connection.caps.generateCapsAttrs()).up();
457 457
             }
458 458
 
@@ -620,7 +620,7 @@ module.exports = function(XMPP, eventEmitter) {
620 620
             if(member.isFocus)
621 621
                 return;
622 622
 
623
-            var displayName = !config.displayJids
623
+            var displayName = !XMPP.options.displayJids
624 624
                 ? member.displayName : Strophe.getResourceFromJid(from);
625 625
 
626 626
             if (displayName && displayName.length > 0) {

+ 0
- 3
modules/xmpp/strophe.jingle.js Просмотреть файл

@@ -11,7 +11,6 @@ module.exports = function(XMPP, eventEmitter) {
11 11
         sessions: {},
12 12
         jid2session: {},
13 13
         ice_config: {iceServers: []},
14
-        pc_constraints: {},
15 14
         activecall: null,
16 15
         media_constraints: {
17 16
             mandatory: {
@@ -107,7 +106,6 @@ module.exports = function(XMPP, eventEmitter) {
107 106
                     // configure session
108 107
 
109 108
                     sess.media_constraints = this.media_constraints;
110
-                    sess.pc_constraints = this.pc_constraints;
111 109
                     sess.ice_config = this.ice_config;
112 110
 
113 111
                     sess.initialize(fromJid, false);
@@ -197,7 +195,6 @@ module.exports = function(XMPP, eventEmitter) {
197 195
             // configure session
198 196
 
199 197
             sess.media_constraints = this.media_constraints;
200
-            sess.pc_constraints = this.pc_constraints;
201 198
             sess.ice_config = this.ice_config;
202 199
 
203 200
             sess.initialize(peerjid, true);

+ 432
- 519
modules/xmpp/xmpp.js
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 2
- 1
package.json Просмотреть файл

@@ -25,7 +25,8 @@
25 25
       "async": "0.9.0",
26 26
       "retry": "0.6.1",
27 27
       "jssha": "1.5.0",
28
-      "socket.io-client": "1.3.6"
28
+      "socket.io-client": "1.3.6",
29
+      "es6-promise": "*"
29 30
   },
30 31
   "devDependencies": {
31 32
   },

Загрузка…
Отмена
Сохранить