Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit cdb2938

Browse files
adamlorek-mqci-bot
and
ci-bot
authored
RC 1.7.0 (#17)
Co-authored-by: ci-bot <[email protected]>
1 parent 2473919 commit cdb2938

File tree

133 files changed

+2203
-773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+2203
-773
lines changed

README.md

+84-23
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,37 @@
22

33
## Video Call App
44

5-
The application available in this repository demonstrates the capabilities of Dolby.io's video call solution for browser applications, built using React.
5+
The application available in this repository demonstrates the capabilities of the Dolby.io video call solution for browser applications, built using React.
66

77
This repository demonstrates how to develop the core Dolby.io features and also provides an understanding of how our service works. If you run into problems, the full Dolby.io Communications SDK for JavaScript documentation can be found at <https://docs.dolby.io/communications-apis/docs/js-overview>.
88

9-
The application provided allows you to evaluate solutions offered by Dolby.io Communications APIs. You can download the repository yourself, run the application locally and verify that it meets your requirements. If you are interested in more details about Dolby.io’s video conference call capabilities, more information can be found here:
9+
The application provided allows you to evaluate solutions offered by the Dolby.io Communications APIs. You can download the repository yourself, run the application locally and verify that it meets your requirements. If you are interested in more details about Dolby.io video conference call capabilities, more information can be found here:
1010
<https://dolby.io/products/video-call/>
1111

12-
Its scope covers:
12+
The scope covers:
1313

14-
- Initialization of Dolby.io SDK
14+
- Initialization of the Dolby.io SDK
1515
- Creating and joining a conference
16-
- Camera, microphone and audio output configuration
16+
- Camera, microphone, and audio output configuration
1717
- Full conference view with grid display of user streams
1818
- Basic video conferencing interactions (muting, camera switching)
1919
- Screen sharing
2020
- Recording
2121
- Background blur (available only on desktop Chrome and Edge)
22+
- Live-streaming through the Dolby.io API after additional setup process [Using Live-streaming features](#using-live-streaming-features)
2223

2324
## Getting Started
2425

25-
The steps below will quickly get you started testing Dolby.io’s capabilities.
26+
The following steps will quickly get you started testing the Dolby.io Communications APIs capabilities.
2627

2728
### How to get a Dolby.io account
2829

29-
Dolby.io Communications APIs requires you to create a Dolby.io account.
30-
To set it up, you need to go to <https://dashboard.dolby.io/signup/> and complete the form. After confirming your email address, you will be logged in.
30+
The Dolby.io Communications APIs requires you to create a Dolby.io account.
31+
To set up your Dolby.io account, go to <https://dashboard.dolby.io/signup/> and complete the form. After confirming your email address, you will be logged in.
3132

3233
### Dolby.io dashboard
3334

34-
After logging in, you get access to the full dashboard where you can manage your account.
35+
After logging in, you have access to the full dashboard where you can manage your account.
3536

3637
From this page <https://dashboard.dolby.io/dashboard/applications/summary> you can manage your profile and billing.
3738

@@ -41,17 +42,17 @@ To run the application, you need to generate a special access token and paste it
4142

4243
## How to run the Video Conferencing app
4344

44-
Below is a list of steps necessary to run the application locally.
45+
The following details the steps required to run the application locally.
4546

46-
### Clone repository
47+
### Clone the repository
4748

4849
Use git to clone the repository with
4950
`git clone [email protected]:dolbyio-samples/comms-app-react-videoconference.git`
5051
or simply download using the green button on the top of this page and unzip the repository.
5152

5253
### Install dependencies
5354

54-
Open the main directory with the terminal. If you are using [Yarn](https://yarnpkg.com/), install dependencies with the following command:
55+
Open the root directory with the terminal. If you are using [Yarn](https://yarnpkg.com/), install dependencies with the following command:
5556

5657
```bash
5758
yarn
@@ -97,38 +98,98 @@ to run the application locally.
9798

9899
### Open the app in a browser
99100

100-
After printing the appropriate message in the terminal window, open <http://localhost:3000> in the browser. The application will launch at this address.
101+
After the appropriate message appears in the terminal window, open <http://localhost:3000> in the browser. The application will launch at this address.
101102

102103
## How to build the Video Conferencing app
103104

104-
Follow the steps of installing dependencies & token configuration from the "How to run the Video Conferencing app" section
105+
Follow the steps of installing dependencies and token configuration from the "How to run the Video Conferencing app" section.
105106

106107
After installing the dependencies, execute the following command:
107108

108109
`yarn build`
109110

110-
This command generated distribution packages in `/dist` directory.
111+
This command generates distribution packages in the `/dist` directory.
111112

112-
#### Base URL configuration
113+
### Base URL configuration
113114

114-
In case you need to serve production content from different path then `/` root, (e.g. extend example.app to example.app/videoconference/) please add the `/.env.production` file with the following content:
115+
In the event that you need to serve production content from a path other than `/` root, (e.g. extend example.app to example.app/videoconference/) please add the `/.env.production` file with the following content:
115116

116-
```
117+
```bash
117118
BASE_URL=<YOUR BASE URL PATH>
118119
```
119120

120-
More about Base URL configuration can be found [here](https://vitejs.dev/config/shared-options.html#base).
121+
Additional information about Base URL configuration can be found [here](https://vitejs.dev/config/shared-options.html#base).
122+
123+
### Using live streaming features
124+
125+
In order to use live streaming features, you need to run an additional proxy server so that POST methods can be properly handled. An example of such a server is placed in the [/api](api/) folder.
126+
127+
> If your application has been started in previous steps, please kill the process and proceed with instructions below.
128+
129+
#### Setting up live streaming
130+
131+
1. In the project root folder, create an `.env` file and add the following variables
132+
133+
```env
134+
VITE_API_PROXY=localhost
135+
VITE_PROXY_PORT=4000
136+
VITE_PROXY_PROTOCOL=http
137+
VITE_STREAMING=true
138+
```
139+
140+
2. In the `/api` directory, create an `.env` file and fill it with the following properties.
141+
142+
```bash
143+
PORT=4000
144+
KEY=APP_KEY
145+
SECRET=APP_SECRET
146+
HOSTNAME=localhost
147+
```
148+
149+
Your `APP_KEY` and `APP_SECRET` can be found in your Dolby.io dashboard, under the app section. **Do not** wrap them in quote marks.
150+
151+
![Keys and secrets](documentation/assets/app_keys.png)
152+
153+
3. Staying inside the `/api` directory, install all dependencies by running the following command
154+
155+
```bash
156+
yarn
157+
```
158+
159+
or
160+
161+
```bash
162+
npm install
163+
```
164+
165+
4. To start both the server and application together, run the following command in the **root** directory:
166+
167+
```bash
168+
yarn run dev-proxy
169+
```
170+
171+
or
172+
173+
```bash
174+
npm run dev-proxy
175+
```
176+
177+
> Ports and hostnames in both `.env` files can be set freely by the user but they need to be the same.
178+
179+
## Adding Custom layouts to your live stream
180+
181+
Please visit this [blog post](https://dolby.io/blog/creating-a-custom-mixer-layout-for-streaming-a-conference/) if you want to explore adding a custom layout to your live stream.
121182

122-
## Known issues & limitations
183+
## Known issues and limitations
123184

124185
- Speaker selection is available only on Chrome
125-
- Copy conference link works only for root directories by default
186+
- The copy conference link works only for root directories by default
126187
- In some cases entering a conference may take more than three seconds
127188
- On Safari 15.4 and below, the local user can hear echo
128189

129-
## Requirements & supported platforms
190+
## Requirements and supported platforms
130191

131-
### Video Conference Call App supports 4 main browsers:
192+
### Video Conference Call App supports four main browsers
132193

133194
- Chrome 100+
134195
- Safari 15+

api/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
.env

api/README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Dolby.io Communications Example Authorisation and Communications proxy
2+
3+
Use this proxy server sample code to connect your Dolby.io communications API based project to our backend services and correctly handle POST requests for features such as starting and stopping RTMP streams.
4+
5+
> **IMPORTANT! we cannot use demo APP_KEY**
6+
7+
## Setup
8+
9+
1. Go to the `/api` directory and run following command to install all necessary dependencies:
10+
11+
```bash
12+
yarn
13+
```
14+
15+
or
16+
17+
```bash
18+
npm install
19+
```
20+
21+
2. In the `/api` directory, create an `.env` file and fill it with the following properties.
22+
23+
```bash
24+
PORT=4000
25+
KEY=APP_KEY
26+
SECRET=APP_SECRET
27+
HOSTNAME=localhost
28+
```
29+
30+
Your `APP_KEY` and `APP_SECRET` can be found in your Dolby.io dashboard, under the app section. **Do not** wrap them in quote marks.
31+
32+
![Keys and secrets](../documentation/assets/app_keys.png)
33+
34+
3. You can start the proxy server by running the following command.
35+
36+
```bash
37+
yarn dev
38+
```
39+
40+
or
41+
42+
```bash
43+
npm dev
44+
```
45+
46+
1. Observe the traffic on your terminal window. Once the live stream feature is enabled in the app, ensure you can see logs pertaining to `start` and `stop` and HTTP response codes to indicate a successful connection.
47+
48+
```bash
49+
[0] 2:28:03 pm - Found 0 errors. Watching for file changes.
50+
[1] Debugger listening on ws://127.0.0.1:9229/ee1f05df-66b8-44c9-b99c-e4952c0d7641
51+
[1] For help, see: https://nodejs.org/en/docs/inspector
52+
[1] Debugger listening on ws://127.0.0.1:9229/13a22631-75dd-4bb1-85ee-37f1a168cbb9
53+
[1] For help, see: https://nodejs.org/en/docs/inspector
54+
[1] Listening at http://localhost:4000/
55+
[1] [POST] 200 - https://api.dolby.io/v1/auth/token
56+
[1] [POST] 200 - https://comms.api.dolby.io/v2/conferences/mix/your-conference-id/rtmp/start
57+
[1] [POST] 200 - https://api.dolby.io/v1/auth/token
58+
[1] [POST] 200 - https://comms.api.dolby.io/v2/conferences/mix/your-conference-id/rtmp/stop
59+
```

api/certs/.gitkeep

Whitespace-only changes.

api/package.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "dolby-api-proxy",
3+
"version": "1.0.0",
4+
"main": "src/main.ts",
5+
"license": "MIT",
6+
"scripts": {
7+
"build": "npx tsc",
8+
"start": "node dist/main.js",
9+
"dev": "concurrently \"npx tsc --watch\" \"wait-on dist/main.js && nodemon -q --inspect dist/main.js\""
10+
},
11+
"dependencies": {
12+
"@dolbyio/dolbyio-rest-apis-client": "3.4.4",
13+
"body-parser": "^1.20.1",
14+
"cors": "^2.8.5",
15+
"dotenv": "^16.0.3",
16+
"express": "^4.18.2"
17+
},
18+
"devDependencies": {
19+
"@types/cors": "^2.8.12",
20+
"@types/express": "^4.17.14",
21+
"@types/node": "^18.11.8",
22+
"concurrently": "^7.5.0",
23+
"nodemon": "^2.0.20",
24+
"typescript": "^4.8.4",
25+
"wait-on": "^6.0.1"
26+
}
27+
}

api/src/main.ts

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import fs from 'fs';
2+
import https from 'https';
3+
import path from 'path';
4+
5+
import * as bodyParser from 'body-parser';
6+
import cors from 'cors';
7+
import dotenv from 'dotenv';
8+
import express from 'express';
9+
10+
import auth from './routes/auth';
11+
import comm from './routes/communication';
12+
13+
dotenv.config();
14+
/*
15+
APP_KEY, and APP_SECRET should be on pair with example application values since we are working on current conference bounded with those values
16+
*/
17+
const { PORT, HOSTNAME, SSL, KEY, SECRET } = process.env;
18+
19+
if (!KEY || !SECRET) {
20+
throw new Error('KEY and SECRET variables are mandatory');
21+
}
22+
23+
const app = express();
24+
25+
// eslint-disable-next-line new-cap
26+
app.use(cors());
27+
app.use(bodyParser.urlencoded({ extended: true }));
28+
app.use(bodyParser.json());
29+
30+
app.use(auth);
31+
app.use(comm);
32+
33+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
34+
// @ts-ignore
35+
let server = null;
36+
37+
if (SSL === 'true') {
38+
const httpsOptions = {
39+
key: fs.readFileSync(path.join(__dirname, '..', 'certs', 'key.pem')),
40+
cert: fs.readFileSync(path.join(__dirname, '..', 'certs', 'cert.pem')),
41+
};
42+
server = https.createServer(httpsOptions, app).listen(PORT, () => {
43+
console.log(`Listening at https://${HOSTNAME}:${PORT}/`);
44+
});
45+
server.on('error handler', console.error);
46+
} else {
47+
server = app.listen(PORT, () => {
48+
console.log(`Listening at http://${HOSTNAME}:${PORT}/`);
49+
});
50+
server.on('error handler', console.error);
51+
}
52+
53+
process.on('SIGTERM', () => {
54+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
55+
// @ts-ignore
56+
server.close(() => {
57+
console.log('Http server closed.');
58+
});
59+
});

api/src/routes/auth.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { communications } from '@dolbyio/dolbyio-rest-apis-client';
2+
import dotenv from 'dotenv';
3+
import express from 'express';
4+
5+
const router = express.Router();
6+
dotenv.config();
7+
8+
const { KEY, SECRET } = process.env;
9+
10+
router.post('/conference/access_token', async (req, res) => {
11+
try {
12+
const token = await communications.authentication.getClientAccessToken(KEY!, SECRET!, 3600);
13+
return res.status(200).send({ data: token });
14+
} catch (e) {
15+
return res.status(500).send(e);
16+
}
17+
});
18+
19+
export default router;

api/src/routes/communication.ts

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { authentication, communications } from '@dolbyio/dolbyio-rest-apis-client';
2+
import dotenv from 'dotenv';
3+
import express from 'express';
4+
5+
import { processErrorStatus } from '../utils/utils';
6+
7+
const router = express.Router();
8+
dotenv.config();
9+
10+
const { KEY, SECRET } = process.env;
11+
12+
router.post('/streaming/start', async ({ body }, res) => {
13+
const { conferenceId, rtmp } = body;
14+
if (!rtmp || !conferenceId) {
15+
return res.status(400).json({ error: 'Missing necessary parameters' });
16+
}
17+
try {
18+
const token = await authentication.getApiAccessToken(KEY!, SECRET!, 3600);
19+
await communications.streaming.startRtmp(token, conferenceId, rtmp);
20+
return res.status(204).send('OK');
21+
} catch (e: any) {
22+
const { status, message } = processErrorStatus(e);
23+
return res.status(status).send(message);
24+
}
25+
});
26+
27+
router.post('/streaming/stop', async ({ body }, res) => {
28+
const { conferenceId } = body;
29+
30+
if (!conferenceId) {
31+
return res.status(400).json({ error: 'Missing conference id param.' });
32+
}
33+
try {
34+
const token = await authentication.getApiAccessToken(KEY!, SECRET!, 3600);
35+
await communications.streaming.stopRtmp(token, conferenceId);
36+
return res.status(204).send('OK');
37+
} catch (e: any) {
38+
console.log(e);
39+
const { status, message } = processErrorStatus(e);
40+
return res.status(status).send(message);
41+
}
42+
});
43+
44+
export default router;

0 commit comments

Comments
 (0)