{"id":27997,"date":"2023-09-08T07:00:00","date_gmt":"2023-09-08T14:00:00","guid":{"rendered":"http:\/\/Displaying-video-recommendations-in-Nuxtjs"},"modified":"2025-11-27T12:14:53","modified_gmt":"2025-11-27T20:14:53","slug":"displaying-video-recommendations-in-nuxtjs","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs","title":{"rendered":"Displaying Video Recommendations in NuxtJS"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>For video-intensive applications, recommendations are a standard feature. We see recommendations seamlessly function in video apps such as Netflix and YouTube. In this article, we\u2019ll learn how we can add them to our custom applications.<\/p>\n<h2>Codesandbox<\/h2>\n<p>The final project can be viewed on <a href=\"https:\/\/codesandbox.io\/s\/video-recommendations-mxoy1\">Codesandbox<\/a>.<\/p>\n<\/div>\n\n\n  <div class=\"wp-block-cloudinary-code-sandbox \">\n    <iframe\n      src=\"https:\/\/codesandbox.io\/embed\/video-recommendations-mxoy1?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=\"video-recommendations\"\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 \"><p>You can find the full source code on my <a href=\"https:\/\/github.com\/musebe\/nuxt-video-recommendations\">Github<\/a> repository.<\/p>\n<h2>Nuxt.Js App Setup<\/h2>\n<p>The first step is to create the scaffold of our app. We\u2019ll use <a href=\"https:\/\/nuxtjs.org\">Nuxt.Js<\/a>, a popular <a href=\"https:\/\/vuejs.org\">Vue.Js<\/a> framework. It boasts of being performant while giving developers an enjoyable user experience.<\/p>\n<p>We\u2019ll use the <a href=\"https:\/\/github.com\/nuxt\/create-nuxt-app\">create-nuxt-app<\/a> utility. Ensure you have yarn or npm v5.2+\/v6.1+ installed. Open the terminal in your preferred working directory:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\">\nyarn create nuxt-app nuxtjs-video-recommendations\n\n<span class=\"hljs-comment\"># OR<\/span>\n\nnpx create-nuxt-app nuxtjs-video-recommendations\n\n<span class=\"hljs-comment\"># OR<\/span>\n\nnpm init nuxt-app nuxtjs-video-recommendations\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><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>The above command will trigger a set of setup questions. Here are our recommended defaults:<\/p>\n<blockquote>\n<p>Project name: nuxtjs-video-recommendations<\/p>\n<\/blockquote>\n<blockquote>\n<p>Programming language: JavaScript<\/p>\n<\/blockquote>\n<blockquote>\n<p>Package manager: Yarn<\/p>\n<\/blockquote>\n<blockquote>\n<p>UI framework: Tailwind CSS<\/p>\n<\/blockquote>\n<blockquote>\n<p>Nuxt.js modules: N\/A<\/p>\n<\/blockquote>\n<blockquote>\n<p>Linting tools: N\/A<\/p>\n<\/blockquote>\n<blockquote>\n<p>Testing framework: None<\/p>\n<\/blockquote>\n<blockquote>\n<p>Rendering mode: Universal (SSR\/SSG)<\/p>\n<\/blockquote>\n<blockquote>\n<p>Deployment target: Server (Node.js hosting)<\/p>\n<\/blockquote>\n<blockquote>\n<p>Development tools: N\/A<\/p>\n<\/blockquote>\n<p>Once the setup is complete, you may enter and run your project:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\">\ncd nuxtjs-vidoe-recommendations\n\n  \n\nyarn dev\n\n<span class=\"hljs-comment\"># OR<\/span>\n\nnpm run dev\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><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>The app should now be running on <a href=\"https:\/\/localhost:3000\">https:\/\/localhost:3000<\/a>.<\/p>\n<h2>Video Setup<\/h2>\n<p>Before we start building, we need to ensure we have the videos we need. We\u2019ll store our videos on <a href=\"https:\/\/cloudinary.com\/\">Cloudinary<\/a>, a media management platform with a powerful set of APIs and SDKs. Storing them on Cloudinary will reduce or app size, hosting costs while delivering the files via a content delivery network (CDN), thus reducing load time. If you don\u2019t have an account, create one <a href=\"https:\/\/cloudinary.com\/users\/register\/free\">here<\/a>.<\/p>\n<p>Proceed to the <a href=\"https:\/\/cloudinary.com\/users\/login?RelayState=%2Fconsole%2Fmedia_library%2Ffolders%2Fhome\">media library<\/a> and create a folder called <code>nuxtjs-video-recommendations<\/code>. Within the folder, add the following videos:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/res.cloudinary.com\/hackit-africa\/video\/upload\/v1639672780\/nuxtjs-video-recommendations\/cookie.mp4\">nuxtjs-video-recommendations\/cookie.mp4<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/res.cloudinary.com\/hackit-africa\/video\/upload\/v1639672717\/nuxtjs-video-recommendations\/food.mp4\">nuxtjs-video-recommendations\/food.mp4<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/res.cloudinary.com\/hackit-africa\/video\/upload\/v1639672804\/nuxtjs-video-recommendations\/street.mp4\">nuxtjs-video-recommendations\/street.mp4<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/res.cloudinary.com\/hackit-africa\/video\/upload\/v1639672712\/nuxtjs-video-recommendations\/plant.mp4\">nuxtjs-video-recommendations\/plant.mp4<\/a><\/p>\n<\/li>\n<\/ul>\n<p>You should now have a folder that resembles this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1764274313\/blog-Displaying_Video_Recommendations_in_NuxtJS-1.webp\" alt=\"Cloudinary folder\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"619\"\/><\/p>\n<h2>Video Player Setup<\/h2>\n<p>The stock HTML5 <code>video<\/code> tag doesn\u2019t support advanced features such as video recommendations. For this reason, we\u2019ll use Cloudinary\u2019s <a href=\"https:\/\/cloudinary.com\/documentation\/cloudinary_video_player\">video player<\/a>.<\/p>\n<p>The setup process is simple. All we need to do is add the video player\u2019s CSS and JavaScript files globally in our project. We\u2019ll use files hosted on the <a href=\"https:\/\/unpkg.com\">UNPKG<\/a> CDN network. Let\u2019s add them to the <code>head<\/code> section of our <code>nuxt.config.js<\/code> file.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">\n<span class=\"hljs-comment\">\/\/ nuxt.config.js<\/span>\n<span class=\"hljs-keyword\">export<\/span>  <span class=\"hljs-keyword\">default<\/span>  {\n  ...\n  link: &#91;\n    ...\n    { <span class=\"hljs-attr\">rel<\/span>:  <span class=\"hljs-string\">'stylesheet'<\/span>, <span class=\"hljs-attr\">href<\/span>:  <span class=\"hljs-string\">'https:\/\/unpkg.com\/cloudinary-video-player@1.5.9\/dist\/cld-video-player.min.css'<\/span>  }\n  ],\n  <span class=\"hljs-attr\">script<\/span>:  &#91;\n      { <span class=\"hljs-attr\">src<\/span>:  <span class=\"hljs-string\">'https:\/\/unpkg.com\/cloudinary-core@latest\/cloudinary-core-shrinkwrap.min.js'<\/span>  },\n      { <span class=\"hljs-attr\">src<\/span>:  <span class=\"hljs-string\">'https:\/\/unpkg.com\/cloudinary-video-player@1.5.9\/dist\/cld-video-player.min.js'<\/span>  },\n    ],\n  },\n  ... \n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><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>Additionally, we also want to be able to connect our Cloudinary account to our codebase by configuring our cloud name globally. To do this, we\u2019ll add it as an environmental variable in our <code>.env<\/code> file. First, create the file if it doesn\u2019t exist.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\">\n<span class=\"hljs-selector-tag\">touch<\/span> <span class=\"hljs-selector-class\">.env<\/span>\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\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Then, add your Cloudinary cloud name. You can find yours in the <strong>Account Details<\/strong> section of the <a href=\"https:\/\/cloudinary.com\/users\/login\">Dashboard<\/a>.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">\nNUXT_ENV_CLOUDINARY_CLOUD_NAME=<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">cloudinary-cloud-name<\/span>&gt;<\/span>\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<h2>Displaying Our Video File<\/h2>\n<p>Before we show our video recommendations, we need to instantiate the video player with a video to play.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">\n\/\/ pages\/index.vue\n\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> {\n    <span class=\"hljs-attr\">name<\/span>: <span class=\"hljs-string\">'IndexPage'<\/span>,\n    \n    data(){\n      <span class=\"hljs-keyword\">return<\/span> {\n        <span class=\"hljs-attr\">cld<\/span>:<span class=\"hljs-literal\">null<\/span>,\n        <span class=\"hljs-attr\">player<\/span>:<span class=\"hljs-literal\">null<\/span>,\n        <span class=\"hljs-attr\">source1<\/span>:  {\n          <span class=\"hljs-attr\">publicId<\/span>:  <span class=\"hljs-string\">\"nuxtjs-video-recommendations\/street\"<\/span>,\n          <span class=\"hljs-attr\">title<\/span>:<span class=\"hljs-string\">'Night Street'<\/span>,\n          <span class=\"hljs-attr\">subtitle<\/span>:<span class=\"hljs-string\">'Street at night with traffic and pedestrians'<\/span>,\n          <span class=\"hljs-attr\">description<\/span>:<span class=\"hljs-string\">'Street at night with traffic and pedestrians'<\/span>\n        },\n      };\n    },\n\n    mounted(){\n      <span class=\"hljs-keyword\">this<\/span>.cld  =  cloudinary.Cloudinary.new({\n        <span class=\"hljs-attr\">cloud_name<\/span>:  process.env.NUXT_ENV_CLOUDINARY_CLOUD_NAME,\n        <span class=\"hljs-attr\">secure<\/span>:  <span class=\"hljs-literal\">true<\/span>,\n        <span class=\"hljs-attr\">transformation<\/span>:  {<span class=\"hljs-attr\">crop<\/span>:  <span class=\"hljs-string\">'limit'<\/span>, <span class=\"hljs-attr\">width<\/span>:  <span class=\"hljs-number\">300<\/span>, <span class=\"hljs-attr\">height<\/span>:<span class=\"hljs-number\">900<\/span>}\n      });\n      <span class=\"hljs-keyword\">this<\/span>.player  =  <span class=\"hljs-keyword\">this<\/span>.cld.videoPlayer(<span class=\"hljs-string\">'recommendations-player'<\/span>, {\n          <span class=\"hljs-attr\">sourceTypes<\/span>:  &#91;<span class=\"hljs-string\">'mp4'<\/span>]\n        }\n      );\n      <span class=\"hljs-keyword\">this<\/span>.player.source(<span class=\"hljs-keyword\">this<\/span>.source1);\n    }\n  }\n<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>In the above code, we\u2019ll create our Cloudinary instance, create the video player based on the <code>recommendations-player<\/code> id, configure the video source, and ensure that the video player loads in MP4 format.<\/p>\n<p>Let\u2019s now add the necessary HTML.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">template<\/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\">video<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"recommendations-player\"<\/span> <span class=\"hljs-attr\">controls<\/span> <span class=\"hljs-attr\">muted<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"cld-video-player cld-video-player-skin-dark w-2\/3 h-96 mx-auto\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">video<\/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\">template<\/span>&gt;<\/span>\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>We add the <code>cld-video-player cld-video-player-skin-dark<\/code> classes to ensure it receives the necessary CSS as well as the dark theme. We should now have a functional video player.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1764274316\/blog-Displaying_Video_Recommendations_in_NuxtJS-2.webp\" alt=\"Video player\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"872\"\/><\/p>\n<p>Right now, when the video finishes playing, we don\u2019t get any recommendations. The only action we can take is to replay the current video.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1764274319\/blog-Displaying_Video_Recommendations_in_NuxtJS-3.webp\" alt=\"No recommendations screenshot\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"872\"\/><\/p>\n<h2>Showing Video Recommendations<\/h2>\n<p>To show recommendations, let\u2019s first add the other video sources to our <code>data<\/code> section.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">\n\/\/ pages\/index.vue\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> {\n    <span class=\"hljs-attr\">name<\/span>: <span class=\"hljs-string\">'IndexPage'<\/span>,\n    data(){\n      <span class=\"hljs-keyword\">return<\/span> {\n        <span class=\"hljs-attr\">cld<\/span>:<span class=\"hljs-literal\">null<\/span>,\n        <span class=\"hljs-attr\">player<\/span>:<span class=\"hljs-literal\">null<\/span>,\n        <span class=\"hljs-attr\">source1<\/span>:  {\n          <span class=\"hljs-attr\">publicId<\/span>:  <span class=\"hljs-string\">\"nuxtjs-video-recommendations\/street\"<\/span>,\n          <span class=\"hljs-attr\">title<\/span>:<span class=\"hljs-string\">'Night Street'<\/span>,\n          <span class=\"hljs-attr\">subtitle<\/span>:<span class=\"hljs-string\">'Street at night with traffic and pedestrians'<\/span>,\n          <span class=\"hljs-attr\">description<\/span>:<span class=\"hljs-string\">'Street at night with traffic and pedestrians'<\/span>\n        },\n        <span class=\"hljs-attr\">source2<\/span>:  {\n          <span class=\"hljs-attr\">publicId<\/span>:  <span class=\"hljs-string\">\"nuxtjs-video-recommendations\/cookie\"<\/span>,\n          <span class=\"hljs-attr\">title<\/span>:<span class=\"hljs-string\">'Cookie'<\/span>,\n          <span class=\"hljs-attr\">subtitle<\/span>:<span class=\"hljs-string\">'Decorating a Cupcake with Gingerbread Cookie'<\/span>,\n          <span class=\"hljs-attr\">description<\/span>:<span class=\"hljs-string\">'Decorating a Cupcake with Gingerbread Cookie'<\/span>\n        },\n        <span class=\"hljs-attr\">source3<\/span>:  {\n          <span class=\"hljs-attr\">publicId<\/span>:  <span class=\"hljs-string\">\"nuxtjs-video-recommendations\/food\"<\/span>,\n          <span class=\"hljs-attr\">title<\/span>:<span class=\"hljs-string\">'Food'<\/span>,\n          <span class=\"hljs-attr\">subtitle<\/span>:<span class=\"hljs-string\">'Video of a Food on Table'<\/span>,\n          <span class=\"hljs-attr\">description<\/span>:<span class=\"hljs-string\">'Video of a Food on Table'<\/span>\n        },\n        <span class=\"hljs-attr\">source4<\/span>:  {\n          <span class=\"hljs-attr\">publicId<\/span>:  <span class=\"hljs-string\">\"nuxtjs-video-recommendations\/plant\"<\/span>,\n          <span class=\"hljs-attr\">title<\/span>:<span class=\"hljs-string\">'plant'<\/span>,\n          <span class=\"hljs-attr\">subtitle<\/span>:<span class=\"hljs-string\">'Close-Up of Plant With Green Leaves'<\/span>,\n          <span class=\"hljs-attr\">description<\/span>:<span class=\"hljs-string\">'Close-Up of Plant With Green Leaves'<\/span>\n        },\n      };\n    },\n    ...\n  };\n<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Now that we have all the sources, we need to set them as recommendations for the first video. We do this by creating a <code>recommendations<\/code> object in the first video with the value of an array of the recommendations.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">\n\/\/ pages\/index.vue\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> {\n    ...\n    mounted(){\n      <span class=\"hljs-keyword\">this<\/span>.source1.recommendations  =  &#91;\n      <span class=\"hljs-keyword\">this<\/span>.source2,\n      <span class=\"hljs-keyword\">this<\/span>.source3,\n      <span class=\"hljs-keyword\">this<\/span>.source4\n      ];\n      ...\n    },\n    ...\n  }\n<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Now we just need to instruct the video player to display the recommendations. We do this by setting <code>autoShowRecommendations<\/code> to <code>true<\/code>.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">\n\/\/ pages\/index.vue\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"javascript\">\n  <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> {\n    ...\n    mounted(){\n      ...\n      this.player  =  <span class=\"hljs-keyword\">this<\/span>.cld.videoPlayer(\n        <span class=\"hljs-string\">'recommendations-player'<\/span>, {\n          <span class=\"hljs-attr\">autoShowRecommendations<\/span>:  <span class=\"hljs-literal\">true<\/span>,\n          <span class=\"hljs-attr\">sourceTypes<\/span>:  &#91;<span class=\"hljs-string\">'mp4'<\/span>]\n        }\n      );\n      ...\n    }\n  }\n<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>When the video ends, we should see some recommendations.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1764274333\/blog-Displaying_Video_Recommendations_in_NuxtJS-4.webp\" alt=\"Recommendations\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1239\"\/><\/p>\n<p>Feel free to review the <a href=\"https:\/\/cloudinary.com\/documentation\/video_player_api_reference\">Video Player API<\/a> to see how to achieve more with your video assets.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":87,"featured_media":31111,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[175,372,303,310],"class_list":["post-27997","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-jamstack","tag-nuxtjs","tag-video","tag-video-player"],"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>Displaying Video Recommendations in NuxtJS<\/title>\n<meta name=\"description\" content=\"For video-intensive applications, video recommendations are a standard feature to ensure a smooth user experience. We see recommendations seamlessly function in video apps such as Netflix and Youtube. Let us learn how we can add them into our own custom applications.\" \/>\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\/displaying-video-recommendations-in-nuxtjs\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Displaying Video Recommendations in NuxtJS\" \/>\n<meta property=\"og:description\" content=\"For video-intensive applications, video recommendations are a standard feature to ensure a smooth user experience. We see recommendations seamlessly function in video apps such as Netflix and Youtube. Let us learn how we can add them into our own custom applications.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-08T14:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-27T20:14:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"1100\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"melindapham\" \/>\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\/displaying-video-recommendations-in-nuxtjs#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs\"},\"author\":{\"name\":\"melindapham\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9\"},\"headline\":\"Displaying Video Recommendations in NuxtJS\",\"datePublished\":\"2023-09-08T14:00:00+00:00\",\"dateModified\":\"2025-11-27T20:14:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs\"},\"wordCount\":5,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA\",\"keywords\":[\"JAMStack\",\"NuxtJS\",\"Video\",\"Video Player\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2023\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs\",\"url\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs\",\"name\":\"Displaying Video Recommendations in NuxtJS\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA\",\"datePublished\":\"2023-09-08T14:00:00+00:00\",\"dateModified\":\"2025-11-27T20:14:53+00:00\",\"description\":\"For video-intensive applications, video recommendations are a standard feature to ensure a smooth user experience. We see recommendations seamlessly function in video apps such as Netflix and Youtube. Let us learn how we can add them into our own custom applications.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA\",\"width\":2000,\"height\":1100},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Displaying Video Recommendations in NuxtJS\"}]},{\"@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\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9\",\"name\":\"melindapham\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g\",\"caption\":\"melindapham\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Displaying Video Recommendations in NuxtJS","description":"For video-intensive applications, video recommendations are a standard feature to ensure a smooth user experience. We see recommendations seamlessly function in video apps such as Netflix and Youtube. Let us learn how we can add them into our own custom applications.","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\/displaying-video-recommendations-in-nuxtjs","og_locale":"en_US","og_type":"article","og_title":"Displaying Video Recommendations in NuxtJS","og_description":"For video-intensive applications, video recommendations are a standard feature to ensure a smooth user experience. We see recommendations seamlessly function in video apps such as Netflix and Youtube. Let us learn how we can add them into our own custom applications.","og_url":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs","og_site_name":"Cloudinary Blog","article_published_time":"2023-09-08T14:00:00+00:00","article_modified_time":"2025-11-27T20:14:53+00:00","og_image":[{"width":2000,"height":1100,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA","type":"image\/jpeg"}],"author":"melindapham","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs"},"author":{"name":"melindapham","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9"},"headline":"Displaying Video Recommendations in NuxtJS","datePublished":"2023-09-08T14:00:00+00:00","dateModified":"2025-11-27T20:14:53+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs"},"wordCount":5,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA","keywords":["JAMStack","NuxtJS","Video","Video Player"],"inLanguage":"en-US","copyrightYear":"2023","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs","url":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs","name":"Displaying Video Recommendations in NuxtJS","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA","datePublished":"2023-09-08T14:00:00+00:00","dateModified":"2025-11-27T20:14:53+00:00","description":"For video-intensive applications, video recommendations are a standard feature to ensure a smooth user experience. We see recommendations seamlessly function in video apps such as Netflix and Youtube. Let us learn how we can add them into our own custom applications.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA","width":2000,"height":1100},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/displaying-video-recommendations-in-nuxtjs#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Displaying Video Recommendations in NuxtJS"}]},{"@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":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9","name":"melindapham","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g","caption":"melindapham"}}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1692903864\/Blog-Display_video_recs_Nuxtjs\/Blog-Display_video_recs_Nuxtjs.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27997","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\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=27997"}],"version-history":[{"count":17,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27997\/revisions"}],"predecessor-version":[{"id":39494,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27997\/revisions\/39494"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/31111"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=27997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=27997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=27997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}