Available Options for the Advanced (in-page) Embed Code

Product(s)
Video Cloud
Brightcove Player
Role(s)
Studio User
Player Developer
Task(s)
Publish Videos
Topic(s)
Playback

In this topic, you will learn about the use and configuration of the Advanced embed code. This version of the player implementation is also referred to as the In-Page or embed_in_page embed code.

Introduction

The Advanced (in-page) embed code permits you to have the player exist in the HTML page directly, not in an iframe. This offers the benefits of ease of accessing the player and associated properties and events. By using the non-iframe player, you lose the ease of use of the player as a single, contained unit in social media applications and sharing. See the Choosing the Correct Embed Code document for further information.

Usage

To use the in-page embed code follow these steps:

  1. Use the PLAYERS module to create a player.
  2. Go to the MEDIA module and publish a video using the newly created player.
  3. Copy the Advanced embed code. The HTML will be similar to the following:
    <video-js data-video-id="4093372393001"
      data-account="1507807800001"
      data-player="ry3j6rsze"
      data-embed="default"
      data-application-id
      class="video-js"
      controls></video-js>
    <script src="https://players.brightcove.net/1507807800001/ry3j6rsze_default/index.min.js"></script>
  4. Copy the HTML from the browser and paste into the body of a full HTML page.
  5. Browse the HTML page to see the player functioning.

When publishing videos using the Media module, you can use the player URL to preview the video or copy the iframe or In-Page embed code to paste into your web page or application.

Note: Click the Shorten button next to the preview URL to generate a shortened preview URL.

The Standard link displays the iframe embed code and the Advanced link displays the In-Page embed code. From the Player Management API perspective, you will also see the Advanced player code referred to as the embed_in_page implementation.

Note: For information on working with responsive players, see the Responsive Sizing for the Brightcove Player developer document.

In-Page embed code (Advanced)

Typical in-page embed code will appear as follows:

<video-js data-video-id="5076962725001"
data-account="1507807800001"
data-player="BkTGbgSq"
data-embed="default"
data-application-id
class="video-js"
controls></video-js>
<script src="https://players.brightcove.net/1507807800001/BkTGbgSq_default/index.min.js"></script>

Although integrating the In-Page publishing code can be more complex, using the In-Page code is best when the page containing the player needs to communicate with the player. Some examples of when to use the In-Page embed code include:

  • The code in the containing page needs to listen for and act on player events
  • The player uses styles from the parent page
  • The iframe code will cause application logic to fail, like a redirect from the parent page

Even if your final implementation does not use the iframe embed code, you can still use the In-Page code with a plugin for your JavaScript and a separate file for your CSS. This encapsulates your logic so that you can easily use it in multiple players.

Chrome and "broken" HTML video icon

Chrome versions 67+ will display a broken video icon momentarily until the <video ...> tag gets converted into a Brightcove Player. The icon appears as follows:

chrome broken video icon

If you are using Brightcove Player version 6.11+, you change the video tag to <video-js ...> and you will NOT see the icon.

Recommendation

It is considered a best practice to use the iframe implementation unless some application logic requires the use of the In-Page code.

Attributes

Numerous attributes are available for the <video> tag to provide additional information about how a player should behave. The table below details available attributes.

Attribute Description Data Type
autoplay Indicates that the player should start playing immediately, on platforms where this is allowed.

If autoplay is set to a Boolean value the browser's native autoplay behavior is used. If it is set to one of the following three valid string values, the following occurs:
  • play: The player will manually try to call play.
  • muted: The player will manually mute the player and call play.
  • any: The player will first try to call play. If that fails, mute the player and call play.
If any of the above fail, the player will display the "Big Play Button" as if autoplay was set to false.

Getting a video to autoplay can be a complex situation. See the Autoplay Considerations document for further details.
Boolean or String
class Standard HTML attribute that will be assigned the video-js value by default. String
controls Determine if the controls should be visible in the player. Boolean
crossorigin If true, the underlying <video> element will have crossorigin="anonymous". This means that any videos or text tracks pulled into the player must have CORS headers. Boolean
data-account The account ID, sometimes also called the Publisher ID. String
data-ad-config-id A Dynamic Delivery SSAI ad configuration ID. String
data-application-id Allows re-use of a single player, but differentiates analytics on a per-site or per-application basis. See the Adding an Application ID to the Player Embed Code document for full details. String
data-embed Displays information if you are using embeds (parent-child player relationships). String
data-player Sets the player ID. String
data-playlist-id Sets the ID or reference ID of the playlist in the player. String
data-playlist-video-id Sets the initial video to be played in the video, which must be in the designated playlist. String
data-start-time Sets the time offset from which a video will start playing. See the Deep Linking document for details. String
data-video-id Sets the ID or reference ID of the video in the player. String
height Sets the display height of the video, measured in pixels ONLY. For further details using percentages for the height see the Sizing the Player document. Number
language Sets the language (using a valid language code, usually two letters) for the player. String
loop Causes the video to start over as soon as it ends. Boolean
muted Mutes the video's sound. Boolean
playsinline If the platform and OS allow it, will display video content within the player's playback area, meaning it won't displayed fullscreen or in an independent, resizable window; does work on iPhone and iPad Boolean
preload Informs the browser whether or not the video data should begin downloading as soon as the video tag is loaded. Possible values are none, metadata or auto. See the next section for further details. String
width Sets the display width of the video, measured in pixels ONLY. For further details using percentages for the width see the Sizing the Player document. Number

preload details

The preload attribute informs the browser whether or not the video data should begin downloading as soon as the video tag is loaded. The options are auto, metadata, and none. For HLS playback technology the settings mean slightly different things and noted below.

  • auto (default): Start loading the video immediately (if the browser agrees). Some mobile devices like iPhones and iPads will not preload the video in order to protect their users' bandwidth. This is why the value is called auto and not something more final like true.

  • metadata: Load only the meta data of the video, which includes information like the duration and dimensions of the video.

  • none: Don't preload any of the video data. This will wait until the user clicks play to begin downloading. Note that on iOS there may be segment downloading even with this setting. See the Brightcove Player and iOS document for more information.

<video-js preload ...>
or
{ "preload": "auto" }