Skip to content

Commit

Permalink
Changes the implementation of the iframe API to use postis
Browse files Browse the repository at this point in the history
  • Loading branch information
hristoterezov committed Jun 17, 2016
1 parent 72d38ad commit 02f176c
Show file tree
Hide file tree
Showing 10 changed files with 516 additions and 571 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ deploy-local.sh
libs/app.bundle.*
libs/lib-jitsi-meet*
libs/external_connect.js
libs/external_api.*
all.css
.remote-sync.json
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ DEPLOY_DIR = libs
BROWSERIFY_FLAGS = -d
OUTPUT_DIR = .
LIBJITSIMEET_DIR = node_modules/lib-jitsi-meet/
IFRAME_API_DIR = ./modules/API/external

all: update-deps compile uglify deploy clean
all: update-deps compile compile-iframe-api uglify uglify-iframe-api deploy clean

update-deps:
$(NPM) install

compile:
$(BROWSERIFY) $(BROWSERIFY_FLAGS) -e app.js -s APP | $(EXORCIST) $(OUTPUT_DIR)/app.bundle.js.map > $(OUTPUT_DIR)/app.bundle.js

compile-iframe-api:
$(BROWSERIFY) $(BROWSERIFY_FLAGS) -e $(IFRAME_API_DIR)/external_api.js -s JitsiMeetExternalAPI | $(EXORCIST) $(OUTPUT_DIR)/external_api.js.map > $(OUTPUT_DIR)/external_api.js

clean:
rm -f $(OUTPUT_DIR)/app.bundle.*
rm -f $(OUTPUT_DIR)/app.bundle.* $(OUTPUT_DIR)/external_api.*

deploy: deploy-init deploy-appbundle deploy-lib-jitsi-meet deploy-css deploy-local

Expand All @@ -28,6 +32,8 @@ deploy-init:
deploy-appbundle:
cp $(OUTPUT_DIR)/app.bundle.min.js $(OUTPUT_DIR)/app.bundle.min.map \
$(OUTPUT_DIR)/app.bundle.js $(OUTPUT_DIR)/app.bundle.js.map \
$(OUTPUT_DIR)/external_api.js.map $(OUTPUT_DIR)/external_api.js \
$(OUTPUT_DIR)/external_api.min.map $(OUTPUT_DIR)/external_api.min.js \
$(DEPLOY_DIR)

deploy-lib-jitsi-meet:
Expand All @@ -46,6 +52,9 @@ deploy-local:
uglify:
$(UGLIFYJS) -p relative $(OUTPUT_DIR)/app.bundle.js -o $(OUTPUT_DIR)/app.bundle.min.js --source-map $(OUTPUT_DIR)/app.bundle.min.map --in-source-map $(OUTPUT_DIR)/app.bundle.js.map

uglify-iframe-api:
$(UGLIFYJS) -p relative $(OUTPUT_DIR)/external_api.js -o $(OUTPUT_DIR)/external_api.min.js --source-map $(OUTPUT_DIR)/external_api.min.map --in-source-map $(OUTPUT_DIR)/external_api.js.map


source-package:
mkdir -p source_package/jitsi-meet/css && \
Expand Down
5 changes: 1 addition & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ function init() {
APP.keyboardshortcut.init();
}).catch(function (err) {
APP.UI.hideRingOverLay();
APP.API.sendPostisMessage({
method: 'video-conference-left',
params: {roomName: APP.conference.roomName}
});
APP.API.notifyConferenceLeft(APP.conference.roomName);
console.error(err);
});
}
Expand Down
13 changes: 2 additions & 11 deletions conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,7 @@ function maybeRedirectToWelcomePage() {
function disconnectAndShowFeedback(requestFeedback) {
APP.UI.hideRingOverLay();
connection.disconnect();
APP.API.sendPostisMessage({
method: 'video-conference-left',
params: {roomName: APP.conference.roomName}
});
APP.API.notifyConferenceLeft(APP.conference.roomName);
if (requestFeedback) {
return APP.UI.requestFeedback();
} else {
Expand Down Expand Up @@ -465,9 +462,6 @@ export default {
this._createRoom(tracks);
this.isDesktopSharingEnabled =
JitsiMeetJS.isDesktopSharingEnabled();
if(this.isDesktopSharingEnabled)
APP.API.addPostisMessageListener('toggle-share-screen',
() => this.toggleScreenSharing());

// if user didn't give access to mic or camera or doesn't have
// them at all, we disable corresponding toolbar buttons
Expand Down Expand Up @@ -908,10 +902,7 @@ export default {
// add local streams when joined to the conference
room.on(ConferenceEvents.CONFERENCE_JOINED, () => {
APP.UI.mucJoined();
APP.API.sendPostisMessage({
method: 'video-conference-joined',
params: {roomName: APP.conference.roomName}
});
APP.API.notifyConferenceJoined(APP.conference.roomName);
});

room.on(
Expand Down
37 changes: 28 additions & 9 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,38 @@ The next step for embedding Jitsi Meet is to create the Jitsi Meet API object
var height = 700;
var api = new JitsiMeetExternalAPI(domain, room, width, height);
</script>
```
```
You can paste that lines in your html code where you want to be placed the Jitsi Meet conference
or you can specify the parent HTML element for the Jitsi Meet conference in the JitsiMeetExternalAPI
constructor.
```javascript
var api = new JitsiMeetExternalAPI(domain, room, width, height, htmlElement);
```
```
If you don't specify room the user will enter in new conference with random room name.

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:
```javascript
var configOverwrite = {enableSimulcast: false};
var interfaceConfigOverwrite = {filmStripOnly: true};
var api = new JitsiMeetExternalAPI(domain, room, width, height, htmlElement, true, configOverwrite, interfaceConfigOverwrite);
```
```

Controlling embedded Jitsi Meet Conference
=========

You can control the embedded Jitsi Meet conference using the JitsiMeetExternalAPI object.

You can send command to Jitsi Meet conference using ```executeCommand```.
You can send command to Jitsi Meet conference using ```executeCommand```.
```
api.executeCommand(command, arguments)
```
The ```command``` parameter is String object with the name of the command.
The ```arguments``` parameter is array with the arguments required by the command.
The ```arguments``` parameter is array with the arguments required by the command.
If no arguments are required by the command this parameter can be omitted or you can pass empty array.
Currently we support the following commands:


* **displayName** - sets the display name of the local participant. This command requires one argument -
* **displayName** - sets the display name of the local participant. This command requires one argument -
the new display name to be set
```
api.executeCommand('displayName', ['New Nickname']);
Expand All @@ -77,7 +77,12 @@ api.executeCommand('toggleChat', [])
api.executeCommand('toggleContactList', [])
```

You can also execute multiple commands using the method ```executeCommands```.
* **toggleShareScreen** - starts / stops the screen sharing. No arguments are required.
```
api.executeCommand('toggleShareScreen', [])
```

You can also execute multiple commands using the method ```executeCommands```.
```
api.executeCommands(commands)
```
Expand Down Expand Up @@ -136,9 +141,23 @@ The listener will receive object with the following structure:
jid: jid //the jid of the participant
}
```
* **video-conference-joined** - event notifications fired when the local user has joined the video conference.
The listener will receive object with the following structure:
```
{
roomName: room //the room name of the conference
}
```
* **video-conference-left** - event notifications fired when the local user has left the video conference.
The listener will receive object with the following structure:
```
{
roomName: room //the room name of the conference
}
```

You can also add multiple event listeners by using ```addEventListeners```.
This method requires one argument of type Object. The object argument must
This method requires one argument of type Object. The object argument must
have keys with the names of the events and values the listeners of the events.

```
Expand Down Expand Up @@ -173,4 +192,4 @@ You can remove the embedded Jitsi Meet Conference with the following code:
api.dispose()
```

It is a good practice to remove the conference before the page is unloaded.
It is a good practice to remove the conference before the page is unloaded.
5 changes: 5 additions & 0 deletions doc/debian/jitsi-meet/jitsi-meet.example
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ server {
ssi on;
}

# Backward compatibility
location ~ /external_api.* {
root /usr/share/jitsi-meet/libs;
}

# BOSH
location /http-bind {
proxy_pass http://localhost:5280/http-bind;
Expand Down
Loading

0 comments on commit 02f176c

Please sign in to comment.