> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Optimize videos in Next.js (video tutorial)

[githublink]: https://github.com/cloudinary-community/cloudinary-examples/tree/main/examples/nextjs-cldvideoplayer

## Overview

This video tutorial teaches you how to optimize the delivery of videos in a Next.js app by using the `CldVideoPlayer` component of the [Next.js SDK](nextjs_integration), which embeds the [Cloudinary Video Player](cloudinary_video_player). 

## Video tutorial

  This video is brought to you by Cloudinary's video player - embed your own!Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.

> **TIP**: :title=View the code

You can find the code from this tutorial in [GitHub][githublink].
## Tutorial contents
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.
### Introduction
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=00 :player=cld} | The `CldVideoPlayer` component of the [Next.js SDK](nextjs_integration) allows you to embed videos for optimized delivery, maximizing performance in Next.js.
|

### Deliver a video using an HTML video tag for comparison
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=16 :player=cld} | Using an HTML video tag to embed a video on a webpage delivers the whole video in its original size and format.
|

### Deliver the video using the Cloudinary CldVideoPlayer component
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=46 :player=cld} | Delivering the same video using the `CldVideoPlayer` component of the [Next.js SDK](nextjs_integration), optimizes the format and quality for delivery, so a much smaller file is delivered.
|

```react
import { CloudinaryVideoPlayer } from "next-cloudinary";

<CldVideoPlayer width={1080} height={607} src="apartment-tour" />
```

### Crop and resize the video
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=2 :sec=11 :player=cld} | In addition to optimizing the format and quality of your videos, you can resize them on the server side so that you deliver only the size you need. Specify an object in the transformation prop including the type of crop, its focus (gravity), plus the width and height.
|

```react
<CldVideoPlayer 
  width={1080} 
  height={607} 
  src="apartment-tour" 
  transformation={{
    crop: "fill",
    gravity: "center",
    width: 1080,
    height: 607,
  }}
/>
```

See examples of using the `CldVideoPlayer` component in [GitHub](https://github.com/cloudinary-community/cloudinary-examples/tree/main/examples/nextjs-cldvideoplayer).

## Keep learning

> **READING**:
>
> * Learn about different ways to [resize and crop your videos](video_resizing_and_cropping).

> * Read our Video Player [guide](cloudinary_video_player) and [reference](video_player_api_reference), covering every available parameter option.

> * Check out some [Video Player code explorers](code_explorers) that you can fork for trying out some sample configuration changes.

> * Watch more [Dev Hints videos](https://www.youtube.com/playlist?list=PL8dVGjLA2oMpaTbvoKCaRNBMQzBUIv7N8) on the [Cloudinary YouTube channel](https://www.youtube.com/cloudinary).

#### If you like this, you might also like...

  
  
  
    Embedding Videos in Next.js
    Use the Cloudinary Video Player to embed videos using Next.js 
  

  
  
  
    Video Transformations
    Build an e-commerce video showcasing products, in Node.js 
  

  
  
  
    Content-aware Video Cropping
    Smartly crop a video using content-aware AI 
  

&nbsp;

&nbsp;Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.
&nbsp;

