Back to api.video Glossary
Embed
What is embedding?
Embedding is the process of adding external content such as links, videos, images, code samples, GIFs, and interactive objects like buttons to a website. The most common way to embed content on the web is through an iframe.
The iframe allows a developer to insert code from a second source on a webpage in a safe way - the code runs in a different context and cannot hijack or pollute the code on the page.
Embedding a video
When a video is uploaded to api.video, a videoId is assigned to the video, and a player URL is created that looks like:
https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27
This url can be pasted into the browser and played, but since it has a JavaScript player and other dependencies, it cannot be simply added to a webpage. For that reason, every API response form api.video also includes the embeddable iframe url:
<iframe src="https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27" width="100%" height="100%" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>
The iframe tells the browser that it can go to 100% the width and height of the container, will fit the size (no scrolling) and can go full screen (so you can see the whole video).