API GET Embed Code HTML

There are two methods I’m aware of for obtaining HTML embed code for a video:

  1. From the Dashboard under Stream > [video] > Embed tab.
  2. Using the API’s /embed end-point.

Only option #1 (Dashboard) is able to produce playable content for me.

The API, option #2, is working and providing HTML code, but the code does not result in playable content. I’d like to confirm firstly, whether the API’s embed code is producing playable content for anyone else? Ideally I’d prefer this option, because if the embed code is updated by Cloudflare, presumably this will naturally take advantage of that.

My current workaround has been to manually construct HTML embed code, using the Dashboard’s example (option #1) as a template.

For the record, I’ve been testing with a video that has no restrictions (eg: origins, signed URL).

The embed code provided differs as you can see below.

Option 1 - Dashboard - WORKING

<div style="position: relative; height: 0px; width: 100%; padding-top: 56.25%;">
<iframe src="https://iframe.videodelivery.net/[some video id]?poster=https://videodelivery.net/[some video id]/thumbnails/thumbnail.jpg?time=&height=600" style="border: none; position: absolute; top: 0; left: 0; height: 100%; width: 100%;" allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;" allowfullscreen="true">
</iframe>
</div>

Option 2 - API - NOT WORKING

<stream src="[some video id]"></stream>
<script data-cfasync="false" defer type="text/javascript" src="https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=[some video id]"></script>

With minor adjustment to the API supplied code, it does work. What’s happening is the API supplied code does not enable controls , so the video is prepped and ready to go, but there’s no play button to make it go, so it just appears blank.

Video in modern browsers usually will not play automatically, if it has sound (such as this case).

Option 2 - API + FIX

<stream src="[some video id]" controls></stream>
<script data-cfasync="false" defer type="text/javascript" src="https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=[some video id]"></script>

I’ve only added controls at the end of the stream tag, and I’m now able to play the video.