Skip to content

Commit

Permalink
Merge pull request #1 from iotum/jerry_hu/meeting-widget
Browse files Browse the repository at this point in the history
implement meeting widget
  • Loading branch information
jerry2013 authored Nov 30, 2022
2 parents b510957 + 9683165 commit c8986e2
Show file tree
Hide file tree
Showing 39 changed files with 13,046 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"overrides": [
{
"files": [
"src/**/*.ts"
]
}
],
"extends": [
"eslint:recommended",
"plugin:jest/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"jest",
"prettier"
],
"rules": {
"prettier/prettier": "error"
},
"ignorePatterns": [
"dist/*"
],
"env": {
"browser": true,
"jest/globals": true
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
index.tsbuildinfo
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
16 changes: 16 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"label": "npm: build",
"detail": "tsc"
}
]
}
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# callbridge-js
Loading wrapper for Callbridge

Loading wrapper for Callbridge WebSDK.

## Installation

### Install the library in your project:

```bash
npm install @iotum/callbridge-js
```

```js
// All widgets
import * as Callbridge from '@iotum/callbridge-js';

// Single widget
import { Meeting } from '@iotum/callbridge-js';
```

### Manually include the script tag in your Single Page App:

Add the following script tag to the `<head>` section on your site.

```js
<script src="https://app.callbridge.com/packs/js/widget.js" async></script>
```

The Widgets are exposed globally under `window.Callbridge`.

## Usage

See Wiki for usage.
24 changes: 24 additions & 0 deletions dist/dashboard.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Widget, { WidgetOptions } from './widget';
/**
* Dashboard page.
*/
export type Page = '' | 'chat' | 'drive' | 'contacts' | 'meetings';
/**
* Callbridge Dashboard.
*/
export default class Dashboard extends Widget {
constructor(
/**
* Widget options
*/
options: WidgetOptions,
/**
* The page to load after logging in
*/
page?: Page);
/**
* Loads the page.
* @param page the page to load.
*/
loadPage(page: Page): void;
}
33 changes: 33 additions & 0 deletions dist/dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const widget_1 = __importDefault(require("./widget"));
/**
* Callbridge Dashboard.
*/
class Dashboard extends widget_1.default {
constructor(
/**
* Widget options
*/
options,
/**
* The page to load after logging in
*/
page = '') {
super(options);
this.load({
redirect_url: `/conf/${page || ''}`,
});
}
/**
* Loads the page.
* @param page the page to load.
*/
loadPage(page) {
this._send('portal', 'loadPage', { page });
}
}
exports.default = Dashboard;
5 changes: 5 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export { WidgetOptions } from './widget';
export { default as Dashboard, Page } from './dashboard';
export { AudioSettings } from './room';
export { default as Meeting, MeetingOptions } from './meeting';
export { default as Livestream, LivestreamOptions } from './livestream';
12 changes: 12 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Livestream = exports.Meeting = exports.Dashboard = void 0;
var dashboard_1 = require("./dashboard");
Object.defineProperty(exports, "Dashboard", { enumerable: true, get: function () { return __importDefault(dashboard_1).default; } });
var meeting_1 = require("./meeting");
Object.defineProperty(exports, "Meeting", { enumerable: true, get: function () { return __importDefault(meeting_1).default; } });
var livestream_1 = require("./livestream");
Object.defineProperty(exports, "Livestream", { enumerable: true, get: function () { return __importDefault(livestream_1).default; } });
37 changes: 37 additions & 0 deletions dist/livestream.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Room from './room';
import { WidgetOptions } from './widget';
/**
* Livestream options.
*/
export type LivestreamOptions = {
/**
* If provided, sets the viewer's name.
*/
name?: string;
/**
* If provided, shows the chat panel to the right of the livestream player. If set to 'intercept', emits an event instead of sending the message.
*/
chat?: boolean | 'intercept';
/**
* If set, hides the native media controls on the livestream player.
*/
hideControls?: boolean;
};
/**
* Callbridge Meeting Room.
*/
export default class Livestream extends Room {
constructor(
/**
* Widget options
*/
options: WidgetOptions,
/**
* The room to stream
*/
roomId: string,
/**
* Livestream options
*/
livestreamOptions?: LivestreamOptions);
}
28 changes: 28 additions & 0 deletions dist/livestream.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const room_1 = __importDefault(require("./room"));
/**
* Callbridge Meeting Room.
*/
class Livestream extends room_1.default {
constructor(
/**
* Widget options
*/
options,
/**
* The room to stream
*/
roomId,
/**
* Livestream options
*/
livestreamOptions) {
super(options);
this.load(Object.assign(Object.assign({}, livestreamOptions), { redirect_url: `/livestream/${roomId}` }));
}
}
exports.default = Livestream;
82 changes: 82 additions & 0 deletions dist/meeting.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import Room from './room';
import { WidgetOptions } from './widget';
/**
* Meeting options.
*/
export type MeetingOptions = {
/**
* If provided, the user will not be prompted for name when entering meeting room.
*/
name?: string;
/**
* If set, the user will skip the video/audio device selection dialog when entering meeting room, and use the system default or previously used devices.
*/
skipJoin?: boolean;
/**
* If set, the user will enter the meeting room with the device turned off.
*/
mute?: {
/**
* Microphone.
*/
mic?: boolean;
/**
* Camera.
*/
camera?: boolean;
};
/**
* If set, the user will enter the meeting room with camera off and without a participant tile to others. They can still hear and be heard by others.
*/
observer?: boolean;
/**
* If provided, the user will enter the meeting room as a moderator.
*/
moderatorToken?: string;
/**
* If provided, sets the maximum sending video resolution.
*/
resolution?: 180 | 360 | 720 | 1080;
/**
* If provided, sets the initial meeting view upon entering. The default view is gallery view.
*/
view?: 'gallery' | 'bottom_speaker' | 'left_side_speaker';
/**
* If provided, sets the maximum on-screen tiles in the gallery view page.
*/
tiles?: number;
/**
* If set, emits audio level events.
*/
audioLevel?: boolean;
/**
* If set, renders the participants as a strip with fixed tile height and 6 tiles.
*/
stripLayout?: boolean;
/**
* Mobile Only. If set, automatically switches speaker view to bottom vs. left based on the device orientation.
*/
autoView?: boolean;
/**
* SSO Only. If provided, the user will be redirected to the provided URL after exiting a call.
*/
afterCallUrl?: string;
};
/**
* Callbridge Meeting Room.
*/
export default class Meeting extends Room {
constructor(
/**
* Widget options
*/
options: WidgetOptions,
/**
* The room to join
*/
roomId: string,
/**
* Meeting options
*/
meetingOptions?: MeetingOptions);
}
44 changes: 44 additions & 0 deletions dist/meeting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const room_1 = __importDefault(require("./room"));
/**
* Callbridge Meeting Room.
*/
class Meeting extends room_1.default {
constructor(
/**
* Widget options
*/
options,
/**
* The room to join
*/
roomId,
/**
* Meeting options
*/
meetingOptions = {}) {
super(options);
const { name, skipJoin, mute: { mic: muteMic, camera: muteCamera } = {}, observer, moderatorToken, resolution, view, tiles, audioLevel, stripLayout, autoView, afterCallUrl, } = meetingOptions;
this.load({
redirect_url: `/conf/call/${roomId}`,
name,
skip_join: skipJoin,
observer,
moderatorToken,
res: resolution,
view,
tiles,
audio_level: audioLevel,
strip_layout: stripLayout,
auto_view: autoView,
after_call_url: afterCallUrl,
mute: [muteMic && 'mic', muteCamera && 'camera'].filter(Boolean).join(',') ||
undefined,
});
}
}
exports.default = Meeting;
Loading

0 comments on commit c8986e2

Please sign in to comment.