---
title: Publitas interactive - YouTube video player
description: If you are working with YouTube on your website, you can easily add Spott's interactive layer by adding a script to your existing implementation. Your current video publishing process is not affected,
---

[Skip to content](https://support.publitas.com/spott-youtube-video-player#main-content)

English

Show submenu for translations

[Contact Support](https://support.publitas.com/kb-tickets/new?hsLang=en)

![Publitas blue-270](https://support.publitas.com/hs-fs/hubfs/Publitas%20blue-270.png?width=175&height=57&name=Publitas%20blue-270.png)

Open main navigation

Close main navigation

- English
  
  Show submenu for translations
- [Contact Support](https://support.publitas.com/kb-tickets/new)
- [Back to Publitas](https://www.publitas.com/)

[Back to Publitas](https://www.publitas.com/)

 How can we help you?

- There are no suggestions because the search field is empty.

1. [Knowledge Base](https://support.publitas.com/?hsLang=en)
2. [Using Publitas Interactive](https://support.publitas.com/using-publitas-interactive?hsLang=en)
3. [Integrations](https://support.publitas.com/using-publitas-interactive?hsLang=en#integrations)

# Publitas interactive - YouTube video player

If you are working with YouTube on your website, you can easily add Spott's interactive layer by adding a script to your existing implementation.

Your current video publishing process is not affected, which means you publish your videos first and add the interactive layer independently.

Our YouTube integration works by adding a code snippet to your website where your video is shown and by adding the YouTube video id in Spott.

 

### 1. Using Spott video ID

If you have access to your own website, this is probably the easiest option. If your website is managed by someone else, it might be best to take a look at the next solution by *using an External ID*

*Before you start these steps, make sure you've uploaded your video to the YouTube platform and added it to your website already.*

**Step 1: Upload your video to Spott and make it interactive**

You'll add interactive elements to your video in the Spott Studio. In order to do that, you should upload your video to the Spott platform.

Log into Spott and go to the [projects page](https://app.spott.ai/projects), upload your video, and make it interactive.

We have a [full step-by-step guide](https://support.publitas.com/hc/en-us/articles/360052364732?hsLang=en) for you if you haven't learned how to do this already.

**Step 2: Put this code snippet on your website**

Go to your website and put in this code snippet. Leave this page open as you still need to make some changes in *step 3.*

*JS Version:*

```
<script src="https://static.spott.ai/videoplayer/js/spott.youtube.js" /></script><div id="youtube_player_id_here"></div><script>  function onYouTubeIframeAPIReady () {    const player = new YT.Player('youtube_player_id_here', {    videoId: 'youtube_video_id_here',    width: '620px',    events: {      'onReady': loadSpottLayer    }    playerVars: {         'autoplay': 1,        'controls': 1,        'autohide': 0,        'wmode': 'opaque',        'origin': ''     }});        function loadSpottLayer() {     if(!player.spottLoaded){      if (window.initSpottYouTube) {       initSpottYouTube(player, {        videoId: "spott_video_id_here"        });       player.spottLoaded=true;     } else {       setTimeout(loadSpottLayer, 500);     }    }   }  };</script><script src="https://www.youtube.com/iframe_api"></script>
```

*iFrame Version:*

```
<script src="https://static.spott.ai/videoplayer/js/spott.youtube.js" /></script><iframe width="560" height="315" id="youtube_player_id_here"   src="https://www.youtube.com/embed/youtube_video_id_here?enablejsapi=1&origin=https://yourwebsite.com"   title="YouTube video example" frameborder="0"   allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"   allowfullscreen></iframe>
```

```
<script>  function onYouTubeIframeAPIReady () {    const player = new YT.Player('youtube_player_id_here', {    events: {      'onReady': loadSpottLayer    }   });        function loadSpottLayer() {     if(!player.spottLoaded){      if (window.initSpottYouTube) {       initSpottYouTube(player, {        videoId: "spott_video_id_here"        });       player.spottLoaded=true;     } else {       setTimeout(loadSpottLayer, 500);     }    }   }  };</script><script src="https://www.youtube.com/iframe_api"></script>
```

The script acts as a bridge between your player and Spott. To set this up, enter these parameters:

- A selector **player** that targets the instance of your video player.
- **videoId** inside initSpottYouTube section is the Spott ID of the video currently initialized, which we'll show you how to get in the next step.
- make sure to add "**enablejsapi=1"** to your YouTube video URL if you use the iFrame version!

**Step 3: Get the Spott video ID**

When you have uploaded your video, go to the Spott Studio, where you can copy the video ID.

Look at the URL and copy the ID, this is the last part of the URL before the '**?**' symbol. You can paste this in the videoId parameter.

 

Paste the Spott video ID you just copied and place in the script on your website.

Awesome, your YouTube video should now have an interactive layer!

### 2. Using YouTube ID

*Before you start these steps, make sure you've uploaded your video to the YouTube platform and added it to your website already.*

**Step 1: Upload your video to Spott and make it interactive**

You'll add interactive elements to your video in the Spott Studio. In order to do that, you should upload your video to the Spott platform.

Log into Spott and go to the [projects page](https://app.spott.ai/projects), upload your video, and make it interactive.

We have a [full step-by-step guide](https://support.publitas.com/hc/en-us/articles/360052364732?hsLang=en) for you if you haven't learned how to do this already.

 

**Step 2: Put this code snippet on your website**

Add the following script to each page:

```
<script src="https://static.spott.ai/videoplayer/js/spott.youtube.js"/></script><script src="https://www.youtube.com/iframe_api"></script>
```

Every time a new video gets initialized in the player, you can trigger its interactive layer with the following snippet:

*JS Version:*

```
<script src="https://static.spott.ai/videoplayer/js/spott.youtube.js" /></script><div id="youtube_player_id_here"></div><script>  function onYouTubeIframeAPIReady () {    const player = new YT.Player('youtube_player_id_here', {    videoId: 'youtube_video_id_here',    width: '620px',    events: {      'onReady': loadSpottLayer    }    playerVars: {         'autoplay': 1,        'controls': 1,        'autohide': 0,        'wmode': 'opaque',        'origin': ''     }});        function loadSpottLayer() {     if(!player.spottLoaded){      if (window.initSpottYouTube) {       initSpottYouTube(player, {});       player.spottLoaded=true;     } else {       setTimeout(loadSpottLayer, 500);     }    }   }  };</script><script src="https://www.youtube.com/iframe_api"></script>
```

The script acts as a bridge between your player and Spott. To set this up, set these parameters:

- A selector **player** that targets the instance of your video player.

### Step 3: Add the external id on Spott

While you're still in the Studio, click on the **Projects** tab

In this modal, you should see "*External source*" and select "YouTube." In the ExternalID field, you can enter your YouTube ID.

For external ID, this is the ID of your YouTube video. This can be found at the end of your YouTube video URL, highlighted in bold:

```
https://www.youtube.com/watch?v=dQw4w9WgXcE
```

Click save to continue. Now you're all set!

### Multiple YouTube videos on a single page

```
<script src="https://static.spott.ai/videoplayer/js/spott.youtube.js" /></script><script src="https://www.youtube.com/iframe_api"></script><script>function onYouTubeIframeAPIReady() {var spottLoaded = false;// VIDEO 1const player1 = new YT.Player('youtube_player_id_1_here', {events: {'onReady': loadSpottPlayer}});// VIDEO 2const player2 = new YT.Player('youtube_player_id_2_here', {events: {'onReady': loadSpottPlayer}});function loadSpottPlayer() {if(!spottLoaded){if (window.initSpottYouTube) {initSpottYouTube(player1, {  videoId: "spott_id_1" });initSpottYouTube(player2, {  videoId: "spott_id_2" });spottLoaded=true;} else {setTimeout(loadSpottLayer, 500);}}}}</script>
```

```
<h2>First video</h2><div class="video-container"> <iframe id="youtube_player_id_1_here" frameborder="0" allowfullscreen="1" allow="accelerometer;   autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"   sandbox="allow-scripts allow-same-origin allow-presentation"    title="First video title" width="630" height="360"   src="https://www.youtube.com/embed/youtube_video_id_1_here?enablejsapi=1"></iframe></div><h2>Second video</h2> <div class="video-container"> <iframe id="youtube_player_id_2_here" frameborder="0" allowfullscreen="1" allow="accelerometer;   autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"   sandbox="allow-scripts allow-same-origin allow-presentation"   title="Second video title" width="630" height="360"  src="https://www.youtube.com/embed/youtube_video_id_2_here?enablejsapi=1"></iframe></div>
```

 

### Make your YouTube video responsive

To make your YouTube videos with interactivity responsive, you can add the following code:  
Make sure the YouTube iframe is wrapped between \<div class="video-container" ...\> 

```
<style>.video-container {  position:relative;  padding-bottom:56.25%;  padding-top:30px;  height:0;  overflow:hidden;}.video-container > div {  position:unset!important;}.video-containeriframe, .video-containerobject, .video-containerembed {  position:absolute;  top:0;  left:0;  width:100%;  height:100%;}<style>
```

 

- [Managing Publications](https://support.publitas.com/managing-publications?hsLang=en#main-content)

    - [Create Content in Publitas](https://support.publitas.com/managing-publications?hsLang=en#create-content-in-publitas)
    - [Managing your publications](https://support.publitas.com/managing-publications?hsLang=en#managing-your-publications)
    - [Editing pages](https://support.publitas.com/managing-publications?hsLang=en#editing-pages)
    - [Updating the Publication URL](https://support.publitas.com/managing-publications?hsLang=en#updating-the-publication-url)
    - [SEO](https://support.publitas.com/managing-publications?hsLang=en#seo)
    - [Troubleshooting](https://support.publitas.com/managing-publications?hsLang=en#troubleshooting)
    - [Create Adaptive content in Publitas](https://support.publitas.com/managing-publications?hsLang=en#create-adaptive-content-in-publitas)
- [Adding Hotspots](https://support.publitas.com/adding-hotspots?hsLang=en#main-content)

    - [Using the hotspot editor](https://support.publitas.com/adding-hotspots?hsLang=en#using-the-hotspot-editor)
    - [Hotspots explained](https://support.publitas.com/adding-hotspots?hsLang=en#hotspots-explained)
    - [Hotspot automation](https://support.publitas.com/adding-hotspots?hsLang=en#hotspot-automation)
- [Customizing the Reader](https://support.publitas.com/customizing-the-reader?hsLang=en#main-content)

    - [Reader settings](https://support.publitas.com/customizing-the-reader?hsLang=en#reader-settings)
    - [Branding](https://support.publitas.com/customizing-the-reader?hsLang=en#branding)
    - [Banners](https://support.publitas.com/customizing-the-reader?hsLang=en#banners)
- [Publishing Publications](https://support.publitas.com/publishing-publications?hsLang=en#main-content)

    - [Sharing](https://support.publitas.com/publishing-publications?hsLang=en#sharing)
    - [Embedding](https://support.publitas.com/publishing-publications?hsLang=en#embedding)
    - [Availability](https://support.publitas.com/publishing-publications?hsLang=en#availability)
    - [Generating reach](https://support.publitas.com/publishing-publications?hsLang=en#generating-reach)
- [E-commerce & Product Feeds](https://support.publitas.com/e-commerce-product-feeds?hsLang=en#main-content)

    - [Importing Product Feeds](https://support.publitas.com/e-commerce-product-feeds?hsLang=en#importing-product-feeds)
    - [Managing product details](https://support.publitas.com/e-commerce-product-feeds?hsLang=en#managing-product-details)
    - [E-commerce Solutions](https://support.publitas.com/e-commerce-product-feeds?hsLang=en#e-commerce-solutions)
- [Dynamic Publications](https://support.publitas.com/dynamic-publications?hsLang=en#main-content)

    - [Creating dynamic content](https://support.publitas.com/dynamic-publications?hsLang=en#creating-dynamic-content)
- [Using Publitas Interactive](https://support.publitas.com/using-publitas-interactive?hsLang=en#main-content)

    - [The basics](https://support.publitas.com/using-publitas-interactive?hsLang=en#the-basics)
    - [Integrations](https://support.publitas.com/using-publitas-interactive?hsLang=en#integrations)
- [Publication Analytics](https://support.publitas.com/publication-analytics?hsLang=en#main-content)

    - [Publication Dashboard](https://support.publitas.com/publication-analytics?hsLang=en#publication-dashboard)
    - [Google Analytics](https://support.publitas.com/publication-analytics?hsLang=en#google-analytics)
    - [Other integrations](https://support.publitas.com/publication-analytics?hsLang=en#other-integrations)
    - [Insights & Recommendations](https://support.publitas.com/publication-analytics?hsLang=en#insights-recommendations)
- [API](https://support.publitas.com/api?hsLang=en#main-content)

    - [Publitas API](https://support.publitas.com/api?hsLang=en#publitas-api)
- [Privacy and Security](https://support.publitas.com/privacy-and-security?hsLang=en#main-content)

    - [Account security](https://support.publitas.com/privacy-and-security?hsLang=en#account-security)
    - [Cookies, privacy, and policies](https://support.publitas.com/privacy-and-security?hsLang=en#cookies-privacy-and-policies)
- [Account](https://support.publitas.com/account?hsLang=en#main-content)

    - [Login and password](https://support.publitas.com/account?hsLang=en#login-and-password)
    - [Managing your account](https://support.publitas.com/account?hsLang=en#managing-your-account)
- [Billing](https://support.publitas.com/billing?hsLang=en#main-content)

    - [Billing Details](https://support.publitas.com/billing?hsLang=en#billing-details)
    - [Subscription](https://support.publitas.com/billing?hsLang=en#subscription)
    - [Data Traffic](https://support.publitas.com/billing?hsLang=en#data-traffic)
- [Partners and Integrations](https://support.publitas.com/partners-and-integrations?hsLang=en)
- [Learning Center](https://support.publitas.com/learning-center?hsLang=en#main-content)

    - [Tutorials](https://support.publitas.com/learning-center?hsLang=en#tutorials)
- [Trust & Safety](https://support.publitas.com/trust-safety?hsLang=en)

[![Publitas blue-270](https://support.publitas.com/hs-fs/hubfs/Publitas%20blue-270.png?width=100&height=32&name=Publitas%20blue-270.png "Publitas blue-270")](http://publitas.com)

Copyright © 2025, Publitas B.V.