Web Player

Player configuration reference

Players configuration methods

This page shows common configurations, each with a ready-to-use embed code. The player supports more options than are listed here.

Configure a player to run a single video

The following example runs a single video hosted on TargetVideo.

Example

<script type="text/javascript" src="https://player.target-video.com/player/build/targetvideo.min.js"></script>

<div id="DIV_ID" style="width:480px;height:270px;"></div>

<script type="text/javascript">
    $bp("DIV_ID", {"id":"PLAYER_ID","width":"480","height":"270","video":"VIDEO_ID"});
</script>

Configure a player to run with a playlist

The following example runs a playlist hosted on TargetVideo.

Example

<script type="text/javascript" src="https://player.target-video.com/player/build/targetvideo.min.js"></script>

<div id="DIV_ID" style="width:480px;height:270px;"></div>

<script type="text/javascript">
    $bp("DIV_ID", {"id":"PLAYER_ID","width":"480","height":"270","playlist":"PLAYLIST_ID"});
</script>

Configure a player to run with latest videos playlist

The following example runs a playlist of the latest videos from your TargetVideo account. The tag playlist below uses the same playlist object, which also accepts "items", the number of videos to load per page (default 25).

Example

<script type="text/javascript" src="https://player.target-video.com/player/build/targetvideo.min.js"></script>

<div id="DIV_ID" style="width:480px;height:270px;"></div>

<script type="text/javascript">
    $bp("DIV_ID", {"id":"PLAYER_ID","width":"480","height":"270","playlist":{"id":"0","mode":"latest"}});
</script>

Configure a player to run latest videos by tag playlist

The following example runs a playlist of the latest videos with a specific tag.

Example

<script type="text/javascript" src="https://player.target-video.com/player/build/targetvideo.min.js"></script>

<div id="DIV_ID" style="width:480px;height:270px;"></div>

<script type="text/javascript">
    $bp("DIV_ID", {"id":"PLAYER_ID","width":"480","height":"270","playlist":{"id":"VIDEO_TAG","mode":"tag"}});
</script>

Configure a player to run custom external video URL

The following example plays a video from your own external URL.

Example

<script type="text/javascript" src="https://player.target-video.com/player/build/targetvideo.min.js"></script>

<div id="DIV_ID" style="width:480px;height:270px;"></div>

<script type="text/javascript">
    $bp("DIV_ID", {"id":"PLAYER_ID","width":"480","height":"270",
        "video":{
            "Video": [
                {
                    "source": {
                        "ld": "240p_mp4_video_url",
                        "sd": "360p_mp4_video_url",
                        "hsd": "480p_mp4_video_url",
                        "hd": "720p_mp4_video_url"
                    }
                }
            ]
        }
    });
</script>

Set custom sticky position

If you want to configure the player to go into a custom sticky position/location you can do it by adding the following "slide_inposition": "#STICKY_DIV_ID" parameter in the embed code. This field can accept any kind of CSS selector.

Example

<script type="text/javascript" src="https://player.target-video.com/player/build/targetvideo.min.js"></script>

<div id="DIV_ID" style="width:480px;height:270px;"></div>

<script type="text/javascript">
    $bp("DIV_ID", {"id":"PLAYER_ID","width":"480","height":"270","video":"VIDEO_ID","slide_inposition":"#STICKY_DIV_ID"});
</script>

Configure playback behavior based on traffic source

To make the player autoplay or click to play depending on where the visitor came from, add "alterPlaybackBehaviour" to the embed code. The player checks the page the visitor came from (document.referrer) and changes its autoplay setting when that page is on one of the listed sites. Set an option to true to use its defaults:

  • "onOrganicTraffic" — click to play for visitors coming from Google, Bing or Yahoo.

  • "onSocialTraffic" — autoplay for visitors coming from Facebook, Instagram or Pinterest.

If the visitor came from any other site, or the browser sends no referrer, the player keeps its own autoplay setting.

Example

$bp("DIV_ID", {"id":"PLAYER_ID","width":"640","height":"360","video":"VIDEO_ID",
    "alterPlaybackBehaviour":{
        "onOrganicTraffic":true,
        "onSocialTraffic":true
    }
});

To choose the behaviour and the sites yourself, pass an object instead of true: "behaviour" is "clickToPlay" or "autoPlay", and "forSites" lists site names to match against the referrer’s domain (for example, "google" matches google.com and www.google.de).

Example

$bp("DIV_ID", {"id":"PLAYER_ID","width":"640","height":"360","video":"VIDEO_ID",
    "alterPlaybackBehaviour":{
        "onOrganicTraffic":{
            "behaviour":"clickToPlay",
            "forSites":["google"]
        },
        "onSocialTraffic":{
            "behaviour":"autoPlay",
            "forSites":["facebook", "linkedin"]
        }
    }
});

Turn off default player localization

By default, player will setup localization by reading the HTML lang attribute from the page. If you want to turn this off you can do that by adding the following parameter in player's embed code: "turnOffLocalization": true

Example

<script type="text/javascript" src="https://player.target-video.com/player/build/targetvideo.min.js"></script>

<div id="DIV_ID" style="width:640px;height:360px;"></div>

<script type="text/javascript">
    $bp("DIV_ID", {"id":"PLAYER_ID","width":"640","height":"360","video":"VIDEO_ID","turnOffLocalization":true});
</script>

Set up custom logo size in the player

Using the below piece of code you can customize the logo in the player easily.
This piece of code needs to be setup on the page where the player is embedded.

Example

<style>
    .bplr-branding {
        width: 200px;
        height: 200px;
        max-width: 50%;
        max-height: 50%;
    }
</style>

Set up custom snapshot image for the player

Using the below parameter in the embed code you can setup custom snapshot for the specific player embed:

Example

<script type="text/javascript" src="https://player.target-video.com/player/build/targetvideo.min.js"></script>

<div id="DIV_ID" style="width:480px;height:270px;"></div>

<script type="text/javascript">
    $bp("DIV_ID", {"id":"PLAYER_ID","width":"480","height":"270","video":"VIDEO_ID","poster":"IMAGE_URL"});
</script>

Consent and privacy options

Add these to the embed code to control how the player handles consent and ad privacy:

  • wait_tcf_api (boolean) — wait for the page’s IAB TCF consent tool (__tcfapi) before requesting ads, and fill the [gdpr] and [consent] macros in your ad tags. Prebid and Amazon bidding wait for it too, and are skipped if the page has no TCF tool. If no consent answer arrives in time, the video plays without ads. Without this option, the player checks consent only when an ad tag contains [gdpr], [consent] or [npa], and still requests ads when the page has no TCF tool.

  • wait_gpp_api (boolean) — the same for the IAB Global Privacy Platform (__gpp): wait for it before requesting ads and fill the [gpp] macro. Without this option, GPP is checked only when an ad tag contains [gpp].

  • ima_secure_mode (boolean) — run VPAID ads in Google IMA’s secure mode. By default the player uses IMA’s insecure VPAID mode.

  • nonce_ppid (string) — a publisher-provided ID (PPID) passed to Google’s Programmatic Access Library (PAL) when an ad tag contains the [paln] or [nonce] macro.

Example

$bp("DIV_ID", {"id":"PLAYER_ID","width":"640","height":"360","video":"VIDEO_ID",
    "wait_tcf_api":true,
    "wait_gpp_api":true,
    "ima_secure_mode":true
});
Player configuration reference · TargetVideo Developer Docs