{"id":27926,"date":"2021-12-28T21:24:30","date_gmt":"2021-12-28T21:24:30","guid":{"rendered":"http:\/\/Build-Customized-Video-Players-with-React"},"modified":"2025-03-08T13:36:10","modified_gmt":"2025-03-08T21:36:10","slug":"build-customized-video-players-with-react","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\/","title":{"rendered":"Build Customized Video Players with React"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>Do you need to add a video player to your website? Cloudinary offers various solutions that make it easy to build and personalize video galleries or video playlists with as many videos as you like.<\/p>\n<p>In this post, we will go through how to add two types of video players to your site using Cloudinary\u2019s JavaScript-based HTML5 video player. The first is an interactive video player, and the second is a video player with playlist functionality.<\/p>\n<p>Here is a <a href=\"https:\/\/codesandbox.io\/s\/cloudinary-video-players-1x7ii\">link<\/a> to the demo on CodeSandbox.<\/p>\n<\/div>\n\n\n  <div class=\"wp-block-cloudinary-code-sandbox \">\n    <iframe\n      src=\"https:\/\/codesandbox.io\/embed\/cloudinary-video-players-1x7ii?theme=dark&amp;codemirror=1&amp;highlights=&amp;editorsize=50&amp;fontsize=14&amp;expanddevtools=0&amp;hidedevtools=0&amp;eslint=0&amp;forcerefresh=0&amp;hidenavigation=0&amp;initialpath=%2F&amp;module=&amp;moduleview=0&amp;previewwindow=&amp;view=&amp;runonclick=1\"\n      height=\"500\"\n      style=\"width: 100%;\"\n      title=\"cloudinary-video-players-1x7ii\"\n      loading=\"lazy\"\n      allow=\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\"\n      sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"\n    ><\/iframe>\n  <\/div>\n\n\n<div class=\"wp-block-cloudinary-markdown \"><h2>Cloudinary Setup<\/h2>\n<p>If you don\u2019t have a Cloudinary account, you can create one for <a href=\"https:\/\/cloudinary.com\/users\/register_free\">free<\/a>. You should see all your credentials on your dashboard page (cloud name, etc.), but we\u2019ll need just the cloud name for this app.<\/p>\n<p>Upload some videos to your account or see <a href=\"https:\/\/cloudinary.com\/documentation\/media_library_upload_tutorial\">this<\/a> short video on how to upload assets to Cloudinary. We need to add resource tags to the videos we want to use to create our playlist. See <a href=\"https:\/\/support.cloudinary.com\/hc\/en-us\/articles\/202520142-How-can-I-tag-an-image-\">here<\/a> for how to add tags to your assets.<\/p>\n<p>We also need to disable the <strong>Resource list<\/strong> option because it is restricted by default. To enable it, click on the <strong>Security setting<\/strong> icon on your Cloudinary console. Click the <strong>Settings<\/strong> link on the security page and uncheck the <strong>Resource list<\/strong> option under <strong>Restricted media types<\/strong>.<\/p>\n<h2>Project Setup<\/h2>\n<p>Open your terminal and run the following command:<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">    npx create-react-app video-players\n<\/code><\/span><\/pre>\n<p>The command creates a React application inside a folder called <code>video-players<\/code>.<\/p>\n<p>The next step is to install the dependencies we will need in this project. Run the following command to install them.<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">    npm install cloudinary-core cloudinary-video-player\n<\/code><\/span><\/pre>\n<p>The command above installs the Cloudinary Video Player and the Cloudinary JavaScript SDK package.<\/p>\n<h2>Video Player Component<\/h2>\n<p>Let\u2019s create the component where both our video players will be rendered. Inside your <code>src<\/code> directory, create a folder called <code>components<\/code>. Create a file called <code>videoPlayer.js<\/code> inside the <code>components<\/code> folder and add the following to it:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">import<\/span> React, { useEffect } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"react\"<\/span>;\n    <span class=\"hljs-keyword\">import<\/span> { Cloudinary } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"cloudinary-core\"<\/span>;\n    \n    <span class=\"hljs-keyword\">const<\/span> cld = <span class=\"hljs-keyword\">new<\/span> Cloudinary({ <span class=\"hljs-attr\">cloud_name<\/span>: <span class=\"hljs-string\">\"ifeomaimoh\"<\/span>, <span class=\"hljs-attr\">secure<\/span>: <span class=\"hljs-literal\">true<\/span> });\n    \n    <span class=\"hljs-keyword\">const<\/span> VideoPlayers = <span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n      <span class=\"hljs-keyword\">return<\/span> (\n        <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"container\"<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n            <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1<\/span>&gt;<\/span>Interactive Video Player<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h1<\/span>&gt;<\/span>\n            <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">p<\/span>&gt;<\/span>Click on the video player to see the UI interactions.<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">p<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n      );\n    };\n    <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> VideoPlayers;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>We\u2019re importing Cloudinary and instantiating a new Cloudinary class configured with our cloud name in the code above. For now, our component called <code>VideoPlayers<\/code> returns a simple UI where we will embed our video players.<\/p>\n<h2>Interactive Video Player<\/h2>\n<p>Let\u2019s go ahead and create our interactive video player. In the <code>components<\/code> folder, create another file named <code>interactive-player.js<\/code> and add the following to it:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">interactivePlayer<\/span>(<span class=\"hljs-params\">cld<\/span>) <\/span>{\n    \n      <span class=\"hljs-keyword\">var<\/span> player = cld.videoPlayer(<span class=\"hljs-string\">\"player\"<\/span>, {\n        <span class=\"hljs-attr\">bigPlayButton<\/span>: <span class=\"hljs-literal\">true<\/span>,\n        <span class=\"hljs-attr\">interactionDisplay<\/span>: {\n          <span class=\"hljs-attr\">theme<\/span>: {\n            <span class=\"hljs-attr\">template<\/span>: <span class=\"hljs-string\">\"shadowed\"<\/span>,\n          },\n          <span class=\"hljs-attr\">layout<\/span>: {\n            <span class=\"hljs-attr\">enable<\/span>: <span class=\"hljs-literal\">true<\/span>,\n            <span class=\"hljs-attr\">showAgain<\/span>: <span class=\"hljs-literal\">true<\/span>,\n          },\n        },\n        <span class=\"hljs-attr\">controls<\/span>: <span class=\"hljs-literal\">true<\/span>,\n        <span class=\"hljs-comment\">\/\/ showJumpControls: true,<\/span>\n      });\n      <span class=\"hljs-keyword\">const<\/span> sources = {\n        <span class=\"hljs-attr\">top<\/span>: <span class=\"hljs-string\">\"https:\/\/res.cloudinary.com\/ifeomaimoh\/video\/upload\/v1637162706\/flower_left_zoom.mp4\"<\/span>,\n        <span class=\"hljs-attr\">middle<\/span>:\n          <span class=\"hljs-string\">\"https:\/\/res.cloudinary.com\/ifeomaimoh\/video\/upload\/v1637162660\/flower_middle_zoom.mp4\"<\/span>,\n        <span class=\"hljs-attr\">bottom<\/span>:\n          <span class=\"hljs-string\">\"https:\/\/res.cloudinary.com\/ifeomaimoh\/video\/upload\/v1637162736\/flower_right_zoom.mp4\"<\/span>,\n      };\n    \n      player.source(<span class=\"hljs-string\">\"flower\"<\/span>, {\n        <span class=\"hljs-attr\">interactionAreas<\/span>: {\n          <span class=\"hljs-attr\">enable<\/span>: <span class=\"hljs-literal\">true<\/span>,\n          <span class=\"hljs-attr\">template<\/span>: <span class=\"hljs-string\">\"landscape\"<\/span>,\n          <span class=\"hljs-attr\">onClick<\/span>: <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">event<\/span>) <\/span>{\n            <span class=\"hljs-keyword\">var<\/span> src = sources&#91;event.item.id];\n            event.zoom(src);\n          },\n        },\n      });\n      <span class=\"hljs-keyword\">return<\/span>;\n    }\n    <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> interactivePlayer;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>In the code above, our function <code>interactivePlayer<\/code> accepts <code>cld<\/code> as props \u2014 the instance of Cloudinary we defined in <code>videoPlayer<\/code>. We instantiate the video player using the <code>videoPlayer<\/code> method, which returns a <code>player<\/code> object.  The method accepts an ID \u2014 that will be the ID of the video element, which tells Cloudinary where to embed the video player. It also accepts some configurations as constructor parameters.<\/p>\n<p>Next, we call the <code>source<\/code> method, which takes a string as its first argument. The string is the public id of the video. We\u2019re adding interactivity (zoom functionality) to our source video by defining a set of interaction areas with the <code>interactionAreas<\/code> object, passed as a second argument.<\/p>\n<p>We\u2019re calling the <code>zoom<\/code> method inside the  <code>onClick<\/code> event handler. The <code>zoom<\/code> method receives a source ID which we are then using to select a video from the <code>sources<\/code> object. This will help us achieve more advanced zooming. See <a href=\"https:\/\/cloudinary.com\/documentation\/video_player_interactive_videos\">here<\/a> for more on interactive videos.<\/p>\n<h2>Embed the Video Player<\/h2>\n<p>Now, let\u2019s bring in our <code>interactivePlayer<\/code> component into our <code>VideoPlayer.js<\/code> file. Update the <code>VideoPlayers<\/code> component with the following:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\">    import React, { useEffect } from <span class=\"hljs-string\">\"react\"<\/span>;\n    import { Cloudinary } from <span class=\"hljs-string\">\"cloudinary-core\"<\/span>;\n    import interactivePlayer from <span class=\"hljs-string\">\".\/interactive-player\"<\/span>;\n    \n    <span class=\"hljs-keyword\">const<\/span> cld = <span class=\"hljs-keyword\">new<\/span> Cloudinary({ cloud_name: <span class=\"hljs-string\">\"ifeomaimoh\"<\/span>, secure: <span class=\"hljs-keyword\">true<\/span> });\n    \n    <span class=\"hljs-keyword\">const<\/span> VideoPlayers = () =&gt; {\n    \n      useEffect(() =&gt; {\n        interactivePlayer(cld);\n      }, &#91;]);\n    \n      <span class=\"hljs-keyword\">return<\/span> (\n        &lt;div className=<span class=\"hljs-string\">\"container\"<\/span>&gt;\n            <span class=\"hljs-comment\">\/\/...<\/span>\n            &lt;div style={{ width: <span class=\"hljs-string\">\"600px\"<\/span>, height: <span class=\"hljs-string\">\"400\"<\/span>, margin: <span class=\"hljs-string\">\"20px\"<\/span> }}&gt;\n              &lt;video\n                id=<span class=\"hljs-string\">\"player\"<\/span>\n                controls\n                muted\n                className=<span class=\"hljs-string\">\"cld-video-player cld-fluid cld-video-player-skin-dark\"<\/span>\n              &gt;&lt;\/video&gt;\n            &lt;\/div&gt;\n          &lt;\/div&gt;\n        &lt;\/div&gt;\n      );\n    };\n    \n    export <span class=\"hljs-keyword\">default<\/span> VideoPlayers;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>In the code above, we imported our <code>interactivePlayer<\/code> function and called it inside a <code>useEffect()<\/code> hook, and it receives <code>cld<\/code> as an argument. We then embed the video player by adding a <code>video<\/code> tag and passing the <code>id<\/code> referenced in the <code>videoPlayer<\/code> method and the <code>cld-video-player<\/code> class.  The video player also receives the <code>cld-video-player<\/code>  <code>cld-fluid<\/code> class, which will dynamically adjust the player size to fit its container or window.<\/p>\n<p>Let\u2019s import the <code>VideoPlayers<\/code> component into our <code>App.js<\/code> file. Replace everything in your <code>App.js<\/code> file with the following:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">import<\/span> React <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"react\"<\/span>;\n    <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-string\">\"cloudinary-video-player\/dist\/cld-video-player.min.css\"<\/span>;\n    <span class=\"hljs-keyword\">import<\/span> VideoPlayers <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\".\/components\/videoPlayer\"<\/span>;\n    \n    <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">App<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n      <span class=\"hljs-keyword\">return<\/span> (\n        <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"App\"<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">VideoPlayers<\/span> \/&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n      );\n    };\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Head over to your browser, you should see the following:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/media_jams\/s_55BE0EDB3C935FEB6D0C5624D984580CEF6347830F099BBB1F2BFEB53E9DCED8_1636836587067_ezgif.com-gif-maker.gif\" alt=\"\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"600\" height=\"297\"\/><\/p>\n<p>You can interact with the video if you click on the areas of interaction we added.<\/p>\n<h2>Video Playlist Player<\/h2>\n<p>Let\u2019s set up a video player with a playlist functionality since we already uploaded and tagged our videos earlier.<\/p>\n<p>Create a file named <code>videoPlaylist.js<\/code> in your components folder and add the following to it:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-string\">\"cloudinary-video-player\"<\/span>;\n    \n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">videoPlaylist<\/span>(<span class=\"hljs-params\">cld<\/span>) <\/span>{\n    \n      <span class=\"hljs-keyword\">const<\/span> player = cld.videoPlayer(<span class=\"hljs-string\">\"playlist\"<\/span>, {\n        <span class=\"hljs-attr\">controls<\/span>: <span class=\"hljs-literal\">true<\/span>,\n        <span class=\"hljs-attr\">bigPlayButton<\/span>: <span class=\"hljs-literal\">true<\/span>,\n        <span class=\"hljs-attr\">playlistWidget<\/span>: {\n          <span class=\"hljs-attr\">direction<\/span>: <span class=\"hljs-string\">\"horizontal\"<\/span>,\n          <span class=\"hljs-attr\">total<\/span>: <span class=\"hljs-number\">6<\/span>,\n        },\n        <span class=\"hljs-attr\">showJumpControls<\/span>: <span class=\"hljs-literal\">true<\/span>,\n      });\n    \n      player.playlistByTag(<span class=\"hljs-string\">\"myTag\"<\/span>, {\n        <span class=\"hljs-attr\">autoAdvance<\/span>: <span class=\"hljs-literal\">false<\/span>,\n        <span class=\"hljs-attr\">repeat<\/span>: <span class=\"hljs-literal\">true<\/span>,\n      });\n      <span class=\"hljs-keyword\">return<\/span>;\n    }\n    <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> videoPlaylist;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Here, we created a function called <code>videoPlaylist<\/code> that accepts <code>cld<\/code> as a parameter. We also instantiate the video player using the <code>videoPlayer<\/code> method, which returns a player object.<\/p>\n<p>The difference between this player and the first one we created is that we\u2019re calling the <code>playlistByTag<\/code> method and passing it a tag (the tag name we specified for our videos) to automatically retrieve and create a playlist of six videos with the specified tag.<\/p>\n<p>We added the playlist widget as a constructor parameter and set the direction for displaying upcoming videos to horizontal.<\/p>\n<p>Now let\u2019s import the <code>videoPlaylist<\/code> component into our <code>videoPlayer.js<\/code> file. Update <code>videoPlayer.js<\/code> with the following:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\">    <span class=\"hljs-comment\">\/\/ import videoPlaylist<\/span>\n    import VideoPlaylist from <span class=\"hljs-string\">\".\/videoPlaylist\"<\/span>;\n    \n    <span class=\"hljs-keyword\">const<\/span> cld = <span class=\"hljs-keyword\">new<\/span> Cloudinary({ cloud_name: <span class=\"hljs-string\">\"ifeomaimoh\"<\/span>, secure: <span class=\"hljs-keyword\">true<\/span> });\n    \n    <span class=\"hljs-keyword\">const<\/span> VideoPlayers = () =&gt; {\n    \n      useEffect(() =&gt; {\n        interactivePlayer(cld);\n        videoPlaylist(cld);\n      }, &#91;]);\n    \n      <span class=\"hljs-keyword\">return<\/span> (\n        &lt;div className=<span class=\"hljs-string\">\"container\"<\/span>&gt;\n            <span class=\"hljs-comment\">\/\/...<\/span>\n    \n            &lt;div style={{ width: <span class=\"hljs-string\">\"600px\"<\/span>, height: <span class=\"hljs-string\">\"400\"<\/span>, margin: <span class=\"hljs-string\">\"20px\"<\/span> }}&gt;\n              &lt;video\n                id=<span class=\"hljs-string\">\"player\"<\/span>\n                controls\n                muted\n                className=<span class=\"hljs-string\">\"cld-video-player cld-fluid cld-video-player-skin-dark\"<\/span>\n              &gt;&lt;\/video&gt;\n            &lt;\/div&gt;\n             {<span class=\"hljs-comment\">\/* Add the following *\/<\/span>}\n            &lt;div style={{ width: <span class=\"hljs-string\">\"600px\"<\/span>, height: <span class=\"hljs-string\">\"400\"<\/span> }} className=<span class=\"hljs-string\">\"video-card\"<\/span>&gt;\n              &lt;video\n                id=<span class=\"hljs-string\">\"playlist-player\"<\/span>\n                className=<span class=\"hljs-string\">\"cld-video-player cld-fluid cld-video-player-skin-dark\"<\/span>\n              &gt;&lt;\/video&gt;\n            &lt;\/div&gt;\n          &lt;\/div&gt;\n        &lt;\/div&gt;\n      );\n    };\n    \n    export <span class=\"hljs-keyword\">default<\/span> VideoPlayers;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<!--- Very interesting, when I do not have the  `<h2>Playlist Video Player<\/h2>` above the 2nd player it will not pop up. Can you please mention that h2 incase reader happens to have bug? \u2014>\n\n<!--- I just tried to reproduce the bug and it and it works just fine for me when I remove the `<h2>Playlist Video Player<\/h2>`. I couldn't reproduce the bug. Please can you try it again? \u2014>\n\nIn the code above, we imported the `videoPlaylist` component and called it inside the `useEffect` hook, where it then receives the `cld` as an argument. Then we embedded the video player with a video tag and passed it its `id` reference and the classes for responsive sizing and dark skin theme.\n\nHead over to your browser; you should see a video player with a playlist generated based on the tag you specified.\n\n\n![](https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/media_jams\/s_B4EF63BCAEFD4CCCCA634E20A16EBA7A5ECCA1626807843F1A2E11E67529143D_1637232156751_CleanShot+2021-11-18+at+14.42.212x.png \"thumb:c_limit,w_2000\/f_auto\/q_auto, with_code:false, popup:false\")\n\n\nIn the configuration for the playlist widget, I specified that it should have a maximum number of six videos displayed horizontally. As a result, our video player creates a playlist of six videos from my Cloudinary account with the specified tag. The widget can only display four video thumbnails at a time, but you can scroll to see the rest.\n\nFind the complete project here on [GitHub](https:\/\/github.com\/ifeoma-imoh\/customized-video-players).\n\n**Resources you may find useful:**\n\n- [Documentation on Cloudinary video player](https:\/\/cloudinary.com\/documentation\/cloudinary_video_player)\n- [Documentation on Cloudinary\u2019s interactive video functionality (Beta)](https:\/\/cloudinary.com\/documentation\/video_player_interactive_videos)\n- [Cloudinary video player API reference](https:\/\/cloudinary.com\/documentation\/video_player_api_reference)\n\n\n<!--- Perfect, flawless build! Thank you so much for your content! -->\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":41,"featured_media":27927,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[134,145,246,371,303],"class_list":["post-27926","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-guest-post","tag-html5","tag-react","tag-under-review","tag-video"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Build Customized Video Players with React<\/title>\n<meta name=\"description\" content=\"In this post, we will go through how to build customized video players using Cloudinary&#039;s JavaScript-based HTML5 video player.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build Customized Video Players with React\" \/>\n<meta property=\"og:description\" content=\"In this post, we will go through how to build customized video players using Cloudinary&#039;s JavaScript-based HTML5 video player.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-28T21:24:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-08T21:36:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be-jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"6000\" \/>\n\t<meta property=\"og:image:height\" content=\"3375\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Build Customized Video Players with React\",\"datePublished\":\"2021-12-28T21:24:30+00:00\",\"dateModified\":\"2025-03-08T21:36:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\/\"},\"wordCount\":6,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be.jpg?_i=AA\",\"keywords\":[\"Guest Post\",\"HTML5\",\"React\",\"Under Review\",\"Video\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2021\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\/\",\"url\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\",\"name\":\"Build Customized Video Players with React\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be.jpg?_i=AA\",\"datePublished\":\"2021-12-28T21:24:30+00:00\",\"dateModified\":\"2025-03-08T21:36:10+00:00\",\"description\":\"In this post, we will go through how to build customized video players using Cloudinary's JavaScript-based HTML5 video player.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be.jpg?_i=AA\",\"width\":6000,\"height\":3375},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build Customized Video Players with React\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Build Customized Video Players with React","description":"In this post, we will go through how to build customized video players using Cloudinary's JavaScript-based HTML5 video player.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react","og_locale":"en_US","og_type":"article","og_title":"Build Customized Video Players with React","og_description":"In this post, we will go through how to build customized video players using Cloudinary's JavaScript-based HTML5 video player.","og_url":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react","og_site_name":"Cloudinary Blog","article_published_time":"2021-12-28T21:24:30+00:00","article_modified_time":"2025-03-08T21:36:10+00:00","og_image":[{"width":6000,"height":3375,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be-jpg?_i=AA","type":"image\/jpeg"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\/"},"author":{"name":"","@id":""},"headline":"Build Customized Video Players with React","datePublished":"2021-12-28T21:24:30+00:00","dateModified":"2025-03-08T21:36:10+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\/"},"wordCount":6,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be.jpg?_i=AA","keywords":["Guest Post","HTML5","React","Under Review","Video"],"inLanguage":"en-US","copyrightYear":"2021","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react\/","url":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react","name":"Build Customized Video Players with React","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be.jpg?_i=AA","datePublished":"2021-12-28T21:24:30+00:00","dateModified":"2025-03-08T21:36:10+00:00","description":"In this post, we will go through how to build customized video players using Cloudinary's JavaScript-based HTML5 video player.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be.jpg?_i=AA","width":6000,"height":3375},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/build-customized-video-players-with-react#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Build Customized Video Players with React"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":""}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681925859\/Web_Assets\/blog\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be\/bcd73d76cea153c6c802da891991b55f4ad377c7-6000x3375-1_27927f85be.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=27926"}],"version-history":[{"count":3,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27926\/revisions"}],"predecessor-version":[{"id":37140,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27926\/revisions\/37140"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/27927"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=27926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=27926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=27926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}