Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Videochat pattern #707

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/pat/videochat/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Description

The *videochat* pattern allows you initialize a video chat session.

## Documentation


### Examples


### Option reference

The fullscreen pattern can be configured through a `data-pat-videochat` attribute.
The available options are:

| Field | Default | Options | Description |
| ----- | ------- | ----------- | ----------- |

26 changes: 26 additions & 0 deletions src/pat/videochat/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Scroll demo</title>
<link rel="stylesheet" href="/style/common.css" type="text/css">
<script src='https://meet.jit.si/external_api.js'></script>
<script src="/bundle.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css" media="screen">
body {
margin: 0;
padding: 0;
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<header>
Jitsi examples
</header>
<section>
<button class="pat-videochat" data-pat-videochat="room:pat-videochat-test; displayname:mimamo; email:[email protected] ">Open Videochat</button>
</section>
</body>
</html>
14 changes: 14 additions & 0 deletions src/pat/videochat/tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
define(["pat-videochat"], function(Pattern) {

describe("Videochat tests", function() {
beforeEach(function() {
var el = document.createElement('button');
document.body.appendChild(el);
});

it("Test 1: Open videochat", function(done) {
done();
});

});
});
48 changes: 48 additions & 0 deletions src/pat/videochat/videochat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
define([
"pat-base",
"pat-parser",
"pat-logger"
], function(Base, Parser, logging) {
var log = logging.getLogger("videochat");
var parser = new Parser('videochat');

parser.addArgument('domain', 'meet.jit.si');
parser.addArgument('room', null);
parser.addArgument('displayname', null);
parser.addArgument('email', null);

return Base.extend({
name: "videochat",
trigger: ".pat-videochat",

init: function($el, opts) {
this.options = parser.parse(this.$el, opts);

var el = this.$el[0];
this.$el.on('click', function (e) {
e.preventDefault();
this.initializeJitsi();
}.bind(this));
},

initializeJitsi: function() {
var userinfo = {};
if (this.options.email) {
userinfo.email = this.options.email;
}
if (this.options.displayname) {
userinfo.displayName = this.options.displayname;
}

var options = {};
if (this.options.room) {
options.roomName = this.options.room;
}
options.userInfo = userinfo;

var api = new JitsiMeetExternalAPI(this.options.domain, options);
return api;
}

});
});
1 change: 1 addition & 0 deletions src/patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ define([
"pat-tooltip-ng",
"pat-url",
"pat-validation",
"pat-videochat",
"pat-zoom"
], function($, registry) {

Expand Down
1 change: 1 addition & 0 deletions webpack/base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ module.exports = {
"pat-tooltip": path.resolve(__dirname, "../src/pat/tooltip/tooltip.js"),
"pat-tooltip-ng": path.resolve(__dirname, "../src/pat/tooltip-ng/tooltip-ng.js"),
"pat-validation": path.resolve(__dirname, "../src/pat/validation/validation.js"),
"pat-videochat": path.resolve(__dirname, "../src/pat/videochat/videochat.js"),
"pat-zoom": path.resolve(__dirname, "../src/pat/zoom/zoom.js")
}
},
Expand Down