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

update readme to include recent wizard-y additions #47

Merged
merged 2 commits into from
Sep 5, 2023
Merged
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
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ export default function Page() {

```bash
cd your-next-app
npm install @mux/next-video
npx @mux/next-video init
```

This will create a `/videos` directory in your project which is where you will put all video source files.
This will (with prompting):

- install `@mux/next-video` as a dependency
- update your `next.config.js` file
- if you're using TypeScript, add types for your video file imports
- create a `/videos` directory in your project which is where you will put all video source files.

It will also add a .gitignore file to the `/videos` directory that ignores video files. Videos, particularly any of reasonable size, shouldn't be stored/tracked by git. Alternatively, if you'd like to store the original files you can remove the added gitignore lines and install [git-lfs](https://git-lfs.github.com/).

Expand All @@ -45,7 +49,9 @@ MUX_TOKEN_ID=[YOUR_TOKEN_ID]
MUX_TOKEN_SECRET=[YOUR_TOKEN_SECRET]
```

### Add Next Video to `next.config.js`
### If you choose to do things manually
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of kicking this to a different doc we can link to, but we can do that later.


#### Add Next Video to `next.config.js`

```js
/** @type {import('next').NextConfig} */
Expand All @@ -56,6 +62,25 @@ const nextConfig = {}; // Your current Next Config object
module.exports = withNextVideo(nextConfig);
```

#### Add video import types to `tsconfig.json`

This is only required if you're using TypeScript, and makes sure your video file imports don't yell at you for missing types. `video.d.ts` should have been created in your project root when you ran `npx @mux/next-video init`, if not you can create it manually:

```ts
// video.d.ts
/// <reference types="@mux/next-video/video-types/global" />
```

Then add that file to the `include` array in `tsconfig.json`.

```js
{
// ...
"include": ["video.d.ts", "next-env.d.ts", /* ... */ ]
// ...
}
```

## Usage

### Local videos
Expand Down