Sample Brightcove Player Prebid Plugin Integration - Prebid in Header


The Brightcove Player Prebid Plugin can be integrated on the publisher’s page in such a way that the pre-bidding can be executed in the header of the page before the Brightcove Player is loaded.


  • Potentially lower latency in rendering selected ad; the reduction in latency is directly related to how long the prebid process is allowed to run.


  • Requires publisher code both in the header to start the prebid process and also in the body to render the ad once the Brightcove Player is loaded.
  • Publisher must register the plugin on page - it cannot register the plugin in Brightcove Studio.


  • There is no guarantee that the prebid process will complete before the Brightcove Player is loaded, so there may still be some latency.
  • If the Brightcove Player is being embedded in a cross-domain (unfriendly) iFrame, then the prebid process must occur in the header of the iFrame and not in the header of the page.

Sample Code

The following is a sample Brightcove Player Prebid Plugin integration that invokes Prebid in the header before Brightcove Player has been loaded.

<!doctype html>
    <meta charset="utf-8">
    <title>Brightcove Player Prebid Plugin - Prebid in Header</title>

    <link href="" rel="stylesheet">
    <link href="" rel="stylesheet">
        // define the prebid options variable
        // NOTE:  you MUST use this variable name
        window.bc_plugin_pbjs = { plugin_prebid_options: {} };

        // specify prebid parameters as the value of biddersSpec
        // the set of bidders here shows how to specify the AppNexus video bidder:  appnexus
        var params = {
            code : 'my-video-tag',
            mediaTypes: {
                video: {
                context: 'instream',
                        playerSize: [640, 480],
                        mimes: ['video/mp4'],
                        protocols: [1, 2, 3, 4, 5, 6, 7, 8],
                        playbackmethod: [2],
                        skip: 1
                bids: [
                        bidder: 'appnexus',
                        params: {
                            placementId: 12334567
        window.bc_plugin_pbjs.plugin_prebid_options.biddersSpec = params;

        // set the Google Ad Manager Parameters
        var dfpParams = {
            params : {
                iu : '/1234456/prebid_cache_video_ad_unit_test',
                output : 'vast'

        window.bc_plugin_pbjs.plugin_prebid_options.dfpParameters = dfpParams;

    <script type="text/javascript" src=""></script>

<body >
    <div style="background: #ff8800; color: #ffffff; overflow:scroll; width:1000px; height:800px;">

        <div id="parentContainer1" style="width:640px; position:absolute; top:100px; left:70px; z-index:1000;">
            <video id="player"
                class="video-js" controls width="600" height="337.5"></video>
            <script src="//"></script>

    // register the plugin
    // set the render options
    var renderoptions = {};
    // set timeOffset for a preroll
    renderoptions.timeOffset = 'start';

    // other publisher preferences can be passed in if needed
    renderoptions.skippable = {enabled: true, videoThreshold : 16, videoOffset : 5};

    BCVideo_PrebidVastPlugin.renderAd(renderoptions, 'player');