diff --git a/src/pat/videochat/documentation.md b/src/pat/videochat/documentation.md new file mode 100644 index 000000000..90361e9b2 --- /dev/null +++ b/src/pat/videochat/documentation.md @@ -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 | +| ----- | ------- | ----------- | ----------- | + diff --git a/src/pat/videochat/index.html b/src/pat/videochat/index.html new file mode 100644 index 000000000..df7583c6a --- /dev/null +++ b/src/pat/videochat/index.html @@ -0,0 +1,26 @@ + + + + + Scroll demo + + + + + + +
+ Jitsi examples +
+
+ +
+ + diff --git a/src/pat/videochat/tests.js b/src/pat/videochat/tests.js new file mode 100644 index 000000000..2d48a15da --- /dev/null +++ b/src/pat/videochat/tests.js @@ -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(); + }); + + }); +}); diff --git a/src/pat/videochat/videochat.js b/src/pat/videochat/videochat.js new file mode 100644 index 000000000..09f3051ca --- /dev/null +++ b/src/pat/videochat/videochat.js @@ -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; + } + + }); +}); diff --git a/src/patterns.js b/src/patterns.js index 9b79badb3..2cc003a3f 100644 --- a/src/patterns.js +++ b/src/patterns.js @@ -69,6 +69,7 @@ define([ "pat-tooltip-ng", "pat-url", "pat-validation", + "pat-videochat", "pat-zoom" ], function($, registry) { diff --git a/webpack/base.config.js b/webpack/base.config.js index 76e7d67fb..69cf87cfd 100644 --- a/webpack/base.config.js +++ b/webpack/base.config.js @@ -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") } },