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

Commit 3e7acdc

Browse files
Merge pull request #11 from muxinc/ll/improve-readme
Improve docs
2 parents 412fec0 + 366296e commit 3e7acdc

8 files changed

+68
-18
lines changed

Mux-dashboard-new-access-token.jpg

38.2 KB
Loading

Mux-dashboard-new-signing-key.jpg

25.5 KB
Loading

Mux-dashboard-new-webhook.jpg

36.8 KB
Loading

README.md

+62-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,64 @@
11
# Mux Meet
22

3-
Mux Meet is a reference implementation of [Mux Real-Time Video](https://mux.com/real-time-video), in React, using the [Next.js](https://nextjs.org/) framework.
3+
Mux Meet is a video conferencing app powered by [Mux Real-Time Video](https://mux.com/real-time-video), written in React, using the [Next.js](https://nextjs.org/) framework.
44

5-
![Four users in a Mux Meet call](/mux-meet.png)
5+
![Four users in a Mux Meet call](/mux-meet.jpg)
66

7-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmuxinc%2Fmeet&env=MUX_TOKEN_ID,MUX_TOKEN_SECRET,MUX_SIGNING_KEY,MUX_PRIVATE_KEY&envDescription=Mux%20Meet%20needs%20API%20keys%20generated%20from%20the%20Mux%20Dashboard.&envLink=https%3A%2F%2Fdocs.mux.com%2Fguides%2Fvideo%2Fmake-api-requests)
7+
# Getting Started
88

9-
## Getting Started
9+
In order for Meet to connect to Mux's APIs, an access token and signing key must be provided. These are generated in the Mux Dashboard and should be set as environment variables.
1010

11-
First, create a space to meet in. For all of these steps we will be using the 'Development' environment. But feel free to use 'Production' when ready.
11+
The easiest way to use Mux Meet is to deploy it to Vercel.
1212

13-
Log in to https://dashboard.mux.com. In the left navigation menu, click on Spaces from within the "/VIDEO" section. Click 'Create New Space' and follow the prompts to create a new space.
13+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmuxinc%2Fmeet&env=MUX_TOKEN_ID,MUX_TOKEN_SECRET,MUX_SIGNING_KEY,MUX_PRIVATE_KEY&envDescription=Mux%20Meet%20needs%20API%20keys%20generated%20from%20the%20Mux%20Dashboard.&envLink=https%3A%2F%2Fdocs.mux.com%2Fguides%2Fvideo%2Fmake-api-requests&project-name=mux-meet&repository-name=mux-meet)
1414

15-
Now, create a .env.local file at the root of the repo with the following secrets:
15+
After creating your project, you will be prompted to configure it.
16+
17+
![Vercel Configure Project](/Vercel-configure-environment-variables.jpg)
18+
19+
In a separate window, open https://dashboard.mux.com and sign in. You will need to create an account, if you don't already have one.
20+
21+
From the [Mux Dashboard](https://dashboard.mux.com), open Settings from the bottom left and click Access Tokens. Then click "Generate new token" and select Mux Video from the list of permissions. Optionally, give the access token a name like Mux Meet.
22+
23+
![Mux Dashboard New Access Token](/Mux-dashboard-new-access-token.jpg)
24+
25+
Once your token is generated, copy and paste the ID and Secret as the values for `MUX_TOKEN_ID` and `MUX_TOKEN_SECRET` in Vercel.
26+
27+
Now go back to https://dashboard.mux.com to generate the Signing Key.
28+
29+
From the [Mux Dashboard](https://dashboard.mux.com), open Settings from the bottom left and click Signing Keys. Then click "Generate new key" and make sure you use the same environment as you did for the Access Token. The Product selection should default to Video.
30+
31+
![Mux Dashboard New Signing Key](/Mux-dashboard-new-signing-key.jpg)
32+
33+
Once your key is generated, copy and paste the ID and Secret as the values for `MUX_SIGNING_KEY` and `MUX_PRIVATE_KEY` in Vercel.
34+
35+
_Both the Access Token and Signing Key are sensitive. DO NOT MAKE THEM PUBLIC. It is safe to store them in Vercel as Environment Variables or locally during development._
36+
37+
Once all 4 environment variables are filled in. Click Deploy for Vercel to build and start your app.
38+
39+
## Cleanup Spaces after Meeting
40+
41+
Joining a new Space creates a Space in Mux, but in order to clean up Spaces after a meeting is over, set up a simple [webhook from Mux](https://docs.mux.com/guides/video/listen-for-webhooks).
42+
43+
From the [Mux Dashboard](https://dashboard.mux.com), open Settings from the bottom left and click Webhooks. Then click "Generate new webhook" and make sure you use the same environment as you did for the Access Token. The URL to notify will be your app's URL + `/api/webhooks`.
44+
45+
![Mux Dashboard New Webhook](/Mux-dashboard-new-webhook.jpg)
46+
47+
Now generate the Webhook and copy the Signing Secret by clicking Show Signing Secret.
48+
49+
Configure your deployed app with a new environment variable named `WEBHOOK_SECRET` with the value of the Webhook Signing Secret.
50+
51+
_Make sure you redeploy for your new environment variable to take affect._
52+
53+
## Limit Access
54+
55+
To limit the number of active Spaces, set an integer value for an environment variable `ACTIVE_SPACE_LIMIT`.
56+
57+
To limit the amount of time participants are allowed to spend in a temporary Space, set an integer value in seconds for an environment variable `SPACE_DURATION_SECONDS`.
58+
59+
# Develop locally
60+
61+
Create an .env.local file at the root of the repo with the following secrets:
1662

1763
```bash
1864
MUX_TOKEN_ID=
@@ -21,12 +67,6 @@ MUX_SIGNING_KEY=
2167
MUX_PRIVATE_KEY=
2268
```
2369

24-
To generate the MUX_TOKEN_ID and MUX_TOKEN_SECRET, log in to https://dashboard.mux.com. Open API Access Tokens from the navigation menu on the left. And generate a new token with Mux Video permissions. You will be given a MUX_TOKEN_ID and a MUX_TOKEN_SECRET. Fill in the values for the .env.local file and don't commit them into the repo.
25-
26-
To generate the MUX_SIGNING_KEY and MUX_PRIVATE_KEY, log in to https://dashboard.mux.com. Open Signing Keys from the navigation menu on the left. And generate a new Video key. You will be given the MUX_SIGNING_KEY as well as the MUX_PRIVATE_KEY. Fill in the values for the .env.local file and don't commit them into the repo. For MUX_PRIVATE_KEY make sure you use the base64-encoded version rather than the raw .pem file download.
27-
28-
Then, run the development server:
29-
3070
```bash
3171
npm run dev
3272
```
@@ -35,11 +75,16 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
3575

3676
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
3777

38-
## Learn More
78+
# Learn More
3979

40-
To learn more about Next.js, take a look at the following resources:
80+
## Mux
81+
82+
- [Mux Real-Time Video](https://mux.com/real-time-video)
83+
- [Real-Time Video in React](https://docs.mux.com/guides/video/send-and-receive-real-time-video-from-a-react-application)
84+
- [Real-Time Video on Android](https://docs.mux.com/guides/video/send-and-receive-real-time-video-from-an-android-application)
85+
- [Real-Time Video on iOS](https://docs.mux.com/guides/video/send-and-receive-real-time-video-from-an-ios-application)
86+
87+
## Next.js
4188

4289
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
4390
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
44-
45-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
66 KB
Loading

mux-meet.jpg

81.8 KB
Loading

mux-meet.png

-327 KB
Binary file not shown.

pages/api/webhooks.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ export default async function handler(
1111
) {
1212
const headers = req.headers;
1313
const muxSignature = headers["mux-signature"] as string;
14-
const secret = process.env.WEBHOOK_SECRET as string;
14+
const secret = process.env.WEBHOOK_SECRET;
15+
16+
if (!secret) {
17+
console.error("WEBHOOK_SECRET not specified");
18+
return res.status(StatusCodes.INTERNAL_SERVER_ERROR).end();
19+
}
1520

1621
if (
1722
req.method === "POST" &&

0 commit comments

Comments
 (0)