Skip to main content
Once a video has finished processing, you can embed it on any page using the Bunny Stream player. This page covers the iframe URL pattern, sizing, and player parameters.

How to embed a video

Place an <iframe> element on your webpage using the following URL pattern. Replace {video_library_id} and {video_id} with your video library and video IDs:
You can generate embed code on the video’s details page in the dashboard. This code is a starting example: adapt its dimensions and styling to your video and your site’s layout.

Sizing and aspect ratio

The Stream player is responsive and automatically fills the width and height of its iframe. You can style the iframe like any other HTML element to match your video and the requirements of your site.

Portrait video

Portrait (9:16) video needs no special player configuration. Set the iframe’s aspect ratio to match the video and the player fills it:
Change aspect-ratio to match your video, such as 16 / 9 for landscape or 1 / 1 for square video. Constrain the container width to suit your layout. aspect-ratio is supported by all current browsers. If you need to support older browsers, size a wrapper with padding instead and stretch the iframe inside it:
The padding percentage is height divided by width: 56.25% for 16:9, 177.78% for 9:16.

Embedding restrictions

Settings outside the embed code can stop the player from loading. Check them when an embed shows a 403 error. Allowed and blocked domains. The library security settings can restrict playback to specific domains. The player identifies the embedding site from the Referer header of the iframe request, and matches its hostname against the lists. See Security options for how entries are matched. Referrer policy. Browsers send the page origin to a cross-origin iframe by default, which is all the domain check needs. If your site sets a stricter policy, such as Referrer-Policy: no-referrer or same-origin, the iframe request arrives without a referrer and is treated as direct access. It is then blocked when Block Direct URL File Access is enabled. Override the policy on the iframe itself:
This sends only the origin, never the full page URL. Content Security Policy. If your site sends a Content-Security-Policy header, allow the player origin in frame-src, for example frame-src https://player.mediadelivery.net. Token authentication. If the library has embed view token authentication enabled, the iframe URL must carry a valid token and expires pair. See Embedded view token authentication.

Parameters

By default, many of the player’s controls and behaviors, such as captions, autoplay, and preload, can be configured on a global scale within the Player tab of your Bunny Stream library settings. Adjusting these default configurations ensures that any video embedded from that library inherits the same baseline behavior, providing a consistent user experience across all embedded instances. However, you can also fine-tune or override these defaults on a per-embed basis by adding query parameters directly to the embed or direct play URL. This flexibility allows you to tailor the playback experience for specific pages or use-cases without affecting the global settings of your library.

Supported Parameters

Boolean parameters accept true, false, 1 or 0. Where the default is a library setting, the parameter overrides that setting for the individual embed.

Direct play URL

The direct play URL is a standalone page that hosts the player, for use when you want to link to a video rather than embed it:
The page wraps the same embed player in a full-window layout and carries Open Graph metadata, so the link unfurls with the video title and thumbnail when shared on social platforms and in chat apps. It accepts the same query parameters as the embed URL:
This example starts playback at 30 seconds.

Player keyboard shortcuts

Bunny Stream player has support for the following keyboard shortcuts.

Custom integration

If you prefer to use your own player or a fully custom video integration, you can directly access the raw video files from Bunny Stream’s infrastructure. Please refer to our Video Storage Structure documentation for details on how to retrieve and utilize video files directly.
Last modified on September 8, 2026