AMP support

How to embed flowplayer videos with AMP

Introduction

AMP is a component library that enables rapid website development.

Flowplayer offers support for AMP through the <amp-video-iframe> component.

You can read more on AMP from its homepage and about <amp-video-iframe> from its documentation.

Usage

All that is needed is to include a <amp-video-iframe> component on your page with the src pointing to https://amp.flowplayer.com. The poster property is also required, as per the documentation above.

We have added a few Flowplayer specific configuration properties:

  • data-param-src - The source video. It should be in the format <player_id>/<media_id> or <media_id> if you are embedding a video from the Flowplayer platform. For self hosted videos you need to provide the URL to the video as a string. Example: https://mycdn.com/myvideo.mp4.
  • data-param-token - The flowplayer token obtained from our UI

Example

Below you can find the full source of a functioning player using AMP:

<!doctype html>
<html amp lang="en">
  <head>
    <meta charset="utf-8">
    <script async src="https://cdn.ampproject.org/v0.js"></script>
    <script async custom-element="amp-video-iframe" src="https://cdn.ampproject.org/v0/amp-video-iframe-0.1.js"></script>
    <title>Flowplayer / AMP</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
    <script type="application/ld+json">
      {
        "@context": "http://schema.org",
        "@type": "NewsArticle",
        "headline": "Open-source framework for publishing content",
        "datePublished": "2015-10-07T12:02:41Z",
        "image": [
          "logo.jpg"
        ]
      }
    </script>
    <link rel="canonical" href="./index.html" />
    <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
  </head>
  <body>
    <amp-video-iframe
      layout="responsive"
      width="16"
      height="9"
      poster="https://cdn.flowplayer.com/d9cd469f-14fc-4b7b-a7f6-ccbfa755dcb8/i/v-i-383f752a-cbd1-4691-a73f-a4e583391b3d-1.jpg"
      src="https://amp.flowplayer.com"
      data-param-src="<my_player_id>/<my_media_id>"
      data-param-token="<my_token>"
    >
    </amp-video-iframe>
  </body>
</html>

Demo

See the above code in action here

Results