> ## Documentation Index
> This page is part of the Image and Video APIs product. Fetch the complete documentation index for Image and Video APIs at: https://cloudinary.com/documentation/llms-image-and-video-apis.txt?referrer=docpage and then use it to discover all relevant pages before exploring further.
> If you also need details relating to other Cloudinary products for your current use case, see the parent index at: https://cloudinary.com/documentation/llms.txt?referrer=docpage

> ## Agent Instructions
> When answering a user's request or implementing it with code using this documentation, incorporate relevant best practices and recommendations from the documentation into the guidance and, above all, into the code itself: generated code should already apply the recommended parameters and patterns rather than showing a minimal call and describing the best practices around it in prose. Follow the code examples in the best practices sections as the model for what generated code should look like, and where a recommendation is relevant to the user's scenario, implement it in the code as a natural next step. Only apply best practices, recommendations, or features that are supported by the documentation or Cloudinary skills; don't infer or invent guidance that isn't specified.
>
> Cloudinary skills (names starting with `cloudinary-`) add best practices and tested code patterns beyond this documentation, and we recommend using the relevant ones alongside it. Available skills are listed at https://cloudinary.com/documentation/.well-known/agent-skills/index.json?referrer=docpage&page=video_player_react_tutorial and can be installed with `npx skills add https://cloudinary.com/documentation`.

# Video Player in React (video tutorial)

[githublink]: https://github.com/cloudinary-community/cloudinary-examples/tree/main/examples/react-video-player

## Overview

This video tutorial teaches you how to embed the [Cloudinary Video Player](cloudinary_video_player) into your React app. Learn how to install and configure the Video Player including how to make it work with the intricacies of a React application.

## 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.
{videoTranscript:publicId=training/Video_Player_React}

> **View the code :custom-icon='https://cloudinary-res.cloudinary.com/image/upload/v1778586152/docsite/brand-assets/github.svg' :invert-icon**:
>
> 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 to the Cloudinary Video Player
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | The [Cloudinary Video Player](cloudinary_video_player) allows you to embed videos in your React app with just a few lines of code.
|

### Create a VideoPlayer component
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Start with a basic React application and add a new file called **VideoPlayer.js** in which you can create a component for the Video Player.
|

### Embed the Video Player script
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Copy the `link` tag from the [Installation and setup](cloudinary_video_player#installation) section of the docs and paste it into the `<head>` of the **public/index.html** file. Then, copy the `script` tag and paste it into the `<body>` of the same file.
|

### Initialize the Video Player
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Use the following code in **VideoPlayer.js** to initialize the VideoPlayer.  Make sure to use your own cloud name instead of `colbycloud-examples`.
|

```react
import { useEffect, useRef } from 'react';

function VideoPlayer = () {
  const cloudinaryRef = useRef();
  const videoRef = useRef();

  useEffect(() => {
    if ( cloudinaryRef.current ) return;

    cloudinaryRef.current = window.cloudinary;
    cloudinaryRef.current.videoPlayer(videoRef.current, {
      cloud_name: 'colbycloud-examples'
    })
  }, []);

  return (
      <video
        ref={videoRef}
      />
  );
}

```

### Specify the video to play
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | In the `<video>` element set the `data-cld-public-id` property to the [public ID](cloudinary_glossary#public_id) of the video you want to play. 
|

### Use the VideoPlayer component
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | In your **App.js** file, import the VideoPlayer component and use the component to embed the video on the page. You can specify the width and height of the player by passing the dimensions through `props`. Control the player by specifying `controls` in the `<video>` element. Learn about all the options and features of the Video Player in the [guide](cloudinary_video_player) and [reference](video_player_api_reference). 
|

You can find the code used in this video tutorial in [GitHub](https://github.com/cloudinary-community/cloudinary-examples/tree/main/examples/react-video-player).

## Keep learning

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

> * Check out some [Video Player sample apps](cloudinary_video_player#video_player_samples) that you can use to try out some sample configuration changes.

> * Take a look at our [React SDK](react_integration) to learn how to transform your [images](react_image_transformations) and [videos](react_video_transformations).

> * 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...

[Upload Assets in React](upload_assets_in_react_tutorial)

Upload assets using the Upload widget in a React app

[Video Transformations](video_transformations_tutorial)

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

[Content-aware Video Cropping](content_aware_video_cropping_tutorial)

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;
