> ## 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 your task extends beyond this product, fetch the top-level index covering all Cloudinary products and topics at: https://cloudinary.com/documentation/llms.txt?referrer=docpage

# 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}

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