Plugins & Integrations

Code examples

See different AMP examples

Sticky AMP player

The example below makes a TargetVideo player sticky (docked) on an AMP page with the dock attribute.

<amp-target-video-player
    dock
    data-partner="PARTNER_ID"
    data-player="PLAYER_ID"
    data-video="VIDEO_ID"
    layout="responsive"
    width="640" height="360">
</amp-target-video-player>

For this to work, your AMP page needs both of these scripts in its <head>. Keep the amp-brid-player name in the first one: it is the name of AMP’s extension, which provides <amp-target-video-player>.

<script async custom-element="amp-brid-player" src="https://cdn.ampproject.org/v0/amp-brid-player-0.1.js"></script>
<script async custom-element="amp-video-docking" src="https://cdn.ampproject.org/v0/amp-video-docking-0.1.js"></script>

Due to various Google AMP limitations, sticky functionality can only work in the following triggering conditions. Note that the video won't be docked unless it's playing manually. This means:

  • If the video has autoplay, the feature will not be triggered unless the user clicks on the video first.

  • If the video does not have autoplay, the feature will not be triggered unless the user plays the video.

  • If the video is paused while scrolling, it will not be docked.

Reference: AMP’s amp-video-docking component.

For more official examples of the player with AMP’s docking component, see brid-player.amp.html in the AMP project on GitHub.

Specify custom placeholder

The example below sets a custom placeholder image for your AMP player.

<amp-target-video-player data-partner="PARTNER_ID" data-player="PLAYER_ID" data-video="VIDEO_ID" layout="responsive" width="480" height="270">
    <amp-img placeholder src="https://your-domain.com/placeholder.jpg" layout="fill" alt="Placeholder"></amp-img>
</amp-target-video-player>
Code examples · TargetVideo Developer Docs