|
@@ -1,215 +0,0 @@
|
1
|
|
-Jitsi Meet API
|
2
|
|
-============
|
3
|
|
-
|
4
|
|
-You can use Jitsi Meet API to embed Jitsi Meet in to your application.
|
5
|
|
-
|
6
|
|
-Installation
|
7
|
|
-==========
|
8
|
|
-
|
9
|
|
-To embed Jitsi Meet in your application you need to add Jitsi Meet API library
|
10
|
|
-```javascript
|
11
|
|
-<script src="https://meet.jit.si/external_api.js"></script>
|
12
|
|
-```
|
13
|
|
-
|
14
|
|
-The next step for embedding Jitsi Meet is to create the Jitsi Meet API object
|
15
|
|
-```javascript
|
16
|
|
-<script>
|
17
|
|
- var domain = "meet.jit.si";
|
18
|
|
- var room = "JitsiMeetAPIExample";
|
19
|
|
- var width = 700;
|
20
|
|
- var height = 700;
|
21
|
|
- var api = new JitsiMeetExternalAPI(domain, room, width, height);
|
22
|
|
-</script>
|
23
|
|
-```
|
24
|
|
-You can paste that lines in your html code where you want to be placed the Jitsi Meet conference
|
25
|
|
-or you can specify the parent HTML element for the Jitsi Meet conference in the JitsiMeetExternalAPI
|
26
|
|
-constructor.
|
27
|
|
-```javascript
|
28
|
|
- var api = new JitsiMeetExternalAPI(domain, room, width, height, htmlElement);
|
29
|
|
-```
|
30
|
|
-If you don't specify room the user will enter in new conference with random room name.
|
31
|
|
-
|
32
|
|
-You can overwrite options set in config.js and interface_config.js. For example, to enable the film-strip-only interface mode and disable simulcast, you can use:
|
33
|
|
-```javascript
|
34
|
|
- var configOverwrite = {enableSimulcast: false};
|
35
|
|
- var interfaceConfigOverwrite = {filmStripOnly: true};
|
36
|
|
- var api = new JitsiMeetExternalAPI(domain, room, width, height, htmlElement, configOverwrite, interfaceConfigOverwrite);
|
37
|
|
-```
|
38
|
|
-
|
39
|
|
-Controlling embedded Jitsi Meet Conference
|
40
|
|
-=========
|
41
|
|
-
|
42
|
|
-You can control the embedded Jitsi Meet conference using the JitsiMeetExternalAPI object.
|
43
|
|
-
|
44
|
|
-You can send command to Jitsi Meet conference using ```executeCommand```.
|
45
|
|
-```
|
46
|
|
-api.executeCommand(command, ...arguments)
|
47
|
|
-```
|
48
|
|
-The ```command``` parameter is String object with the name of the command.
|
49
|
|
-Currently we support the following commands:
|
50
|
|
-
|
51
|
|
-
|
52
|
|
-* **displayName** - sets the display name of the local participant. This command requires one argument -
|
53
|
|
-the new display name to be set
|
54
|
|
-```
|
55
|
|
-api.executeCommand('displayName', 'New Nickname');
|
56
|
|
-```
|
57
|
|
-* **toggleAudio** - mutes / unmutes the audio for the local participant. No arguments are required.
|
58
|
|
-```
|
59
|
|
-api.executeCommand('toggleAudio')
|
60
|
|
-```
|
61
|
|
-* **toggleVideo** - mutes / unmutes the video for the local participant. No arguments are required.
|
62
|
|
-```
|
63
|
|
-api.executeCommand('toggleVideo')
|
64
|
|
-```
|
65
|
|
-* **toggleFilmStrip** - hides / shows the film strip. No arguments are required.
|
66
|
|
-```
|
67
|
|
-api.executeCommand('filmStrip')
|
68
|
|
-```
|
69
|
|
-* **toggleChat** - hides / shows the chat. No arguments are required.
|
70
|
|
-```
|
71
|
|
-api.executeCommand('toggleChat')
|
72
|
|
-```
|
73
|
|
-* **toggleContactList** - hides / shows the contact list. No arguments are required.
|
74
|
|
-```
|
75
|
|
-api.executeCommand('toggleContactList')
|
76
|
|
-```
|
77
|
|
-
|
78
|
|
-* **toggleShareScreen** - starts / stops the screen sharing. No arguments are required.
|
79
|
|
-```
|
80
|
|
-api.executeCommand('toggleShareScreen')
|
81
|
|
-```
|
82
|
|
-
|
83
|
|
-* **hangup** - Hangups the call. No arguments are required.
|
84
|
|
-```
|
85
|
|
-api.executeCommand('hangup')
|
86
|
|
-```
|
87
|
|
-
|
88
|
|
-* **email** - Hangups the call. No arguments are required.
|
89
|
|
-```
|
90
|
|
-api.executeCommand('email', 'example@example.com')
|
91
|
|
-```
|
92
|
|
-
|
93
|
|
-* **avatarUrl** - Hangups the call. No arguments are required.
|
94
|
|
-```
|
95
|
|
-api.executeCommand('avatarUrl', 'avatarUrl')
|
96
|
|
-```
|
97
|
|
-
|
98
|
|
-You can also execute multiple commands using the method ```executeCommands```.
|
99
|
|
-```
|
100
|
|
-api.executeCommands(commands)
|
101
|
|
-```
|
102
|
|
-The ```commands``` parameter is object with keys the names of the commands and values the arguments for the
|
103
|
|
-commands.
|
104
|
|
-
|
105
|
|
-```
|
106
|
|
-api.executeCommands({displayName: ['nickname'], toggleAudio: []});
|
107
|
|
-```
|
108
|
|
-
|
109
|
|
-You can add event listeners to the embedded Jitsi Meet using ```addEventListener``` method.
|
110
|
|
-```
|
111
|
|
-api.addEventListener(event, listener)
|
112
|
|
-```
|
113
|
|
-The ```event``` parameter is String object with the name of the event.
|
114
|
|
-The ```listener``` paramenter is Function object with one argument that will be notified when the event occurs
|
115
|
|
-with data related to the event.
|
116
|
|
-
|
117
|
|
-Currently we support the following events:
|
118
|
|
-
|
119
|
|
-* **incomingMessage** - event notifications about incoming
|
120
|
|
-messages. The listener will receive object with the following structure:
|
121
|
|
-```
|
122
|
|
-{
|
123
|
|
-"from": from,//JID of the user that sent the message
|
124
|
|
-"nick": nick,//the nickname of the user that sent the message
|
125
|
|
-"message": txt//the text of the message
|
126
|
|
-}
|
127
|
|
-```
|
128
|
|
-* **outgoingMessage** - event notifications about outgoing
|
129
|
|
-messages. The listener will receive object with the following structure:
|
130
|
|
-```
|
131
|
|
-{
|
132
|
|
-"message": txt//the text of the message
|
133
|
|
-}
|
134
|
|
-```
|
135
|
|
-* **displayNameChanged** - event notifications about display name
|
136
|
|
-change. The listener will receive object with the following structure:
|
137
|
|
-```
|
138
|
|
-{
|
139
|
|
-jid: jid,//the JID of the participant that changed his display name
|
140
|
|
-displayname: displayName //the new display name
|
141
|
|
-}
|
142
|
|
-```
|
143
|
|
-* **participantJoined** - event notifications about new participant.
|
144
|
|
-The listener will receive object with the following structure:
|
145
|
|
-```
|
146
|
|
-{
|
147
|
|
-jid: jid //the jid of the participant
|
148
|
|
-}
|
149
|
|
-```
|
150
|
|
-* **participantLeft** - event notifications about participant that left room.
|
151
|
|
-The listener will receive object with the following structure:
|
152
|
|
-```
|
153
|
|
-{
|
154
|
|
-jid: jid //the jid of the participant
|
155
|
|
-}
|
156
|
|
-```
|
157
|
|
-* **videoConferenceJoined** - event notifications fired when the local user has joined the video conference.
|
158
|
|
-The listener will receive object with the following structure:
|
159
|
|
-```
|
160
|
|
-{
|
161
|
|
-roomName: room //the room name of the conference
|
162
|
|
-}
|
163
|
|
-```
|
164
|
|
-* **videoConferenceLeft** - event notifications fired when the local user has left the video conference.
|
165
|
|
-The listener will receive object with the following structure:
|
166
|
|
-```
|
167
|
|
-{
|
168
|
|
-roomName: room //the room name of the conference
|
169
|
|
-}
|
170
|
|
-```
|
171
|
|
-
|
172
|
|
-* **readyToClose** - event notification fired when Jitsi Meet is ready to be closed (hangup operations are completed).
|
173
|
|
-
|
174
|
|
-You can also add multiple event listeners by using ```addEventListeners```.
|
175
|
|
-This method requires one argument of type Object. The object argument must
|
176
|
|
-have keys with the names of the events and values the listeners of the events.
|
177
|
|
-
|
178
|
|
-```
|
179
|
|
-function incomingMessageListener(object)
|
180
|
|
-{
|
181
|
|
-...
|
182
|
|
-}
|
183
|
|
-
|
184
|
|
-function outgoingMessageListener(object)
|
185
|
|
-{
|
186
|
|
-...
|
187
|
|
-}
|
188
|
|
-
|
189
|
|
-api.addEventListeners({
|
190
|
|
- incomingMessage: incomingMessageListener,
|
191
|
|
- outgoingMessage: outgoingMessageListener})
|
192
|
|
-```
|
193
|
|
-
|
194
|
|
-If you want to remove a listener you can use ```removeEventListener``` method with argument the name of the event.
|
195
|
|
-```
|
196
|
|
-api.removeEventListener("incomingMessage");
|
197
|
|
-```
|
198
|
|
-
|
199
|
|
-If you want to remove more than one event you can use ```removeEventListeners``` method with argument
|
200
|
|
- array with the names of the events.
|
201
|
|
-```
|
202
|
|
-api.removeEventListeners(["incomingMessage", "outgoingMessageListener"]);
|
203
|
|
-```
|
204
|
|
-
|
205
|
|
-You can get the number of participants in the conference with the following code:
|
206
|
|
-```
|
207
|
|
-var numberOfParticipants = api.getNumberOfParticipants();
|
208
|
|
-```
|
209
|
|
-
|
210
|
|
-You can remove the embedded Jitsi Meet Conference with the following code:
|
211
|
|
-```
|
212
|
|
-api.dispose()
|
213
|
|
-```
|
214
|
|
-
|
215
|
|
-It is a good practice to remove the conference before the page is unloaded.
|