Video Player in React (video tutorial)
Last updated: Sep-02-2024
On this page:
Overview
This video tutorial teaches you how to embed the 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
View the code
You can find the code from this tutorial in GitHub.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
The Cloudinary Video Player allows you to embed videos in your React app with just a few lines of code. | |
Create a VideoPlayer component
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
Copy the link tag from the Installation and setup 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
Use the following code in VideoPlayer.js to initialize the VideoPlayer. Make sure to use your own cloud name instead of colbycloud-examples . |
|
Specify the video to play
In the <video> element set the data-cld-public-id property to the public ID of the video you want to play. |
|
Use the VideoPlayer component
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 and reference. |
|
You can find the code used in this video tutorial in GitHub.
Keep learning
Related topics
- Read our Video Player guide and reference, covering every available parameter option.
- Check out some Video Player code explorers that you can fork for trying out some sample configuration changes.
- Take a look at our React SDK to learn how to transform your images and videos.
- Watch more Dev Hints videos on the Cloudinary YouTube channel.
If you like this, you might also like...
Upload Assets in React
Upload assets using the Upload widget in a React AppVideo Transformations
Build an e-commerce video showcasing products, in Node.jsContent-aware Video Cropping
Smartly crop a video using content-aware AI
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.
✖️