Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

Aniview Studio is a feature that enables management of instream and outstream players in a flexible way.

The studio tag has a javascript API that can be used for customizing the studio configuration when loading the script and in order to hook into the player API and events

The default structure of a studio tag looks like this:
<script async id="AV5fdc6ff3ad9eb744ab2c91db" type="text/javascript" src="https://tg1.aniview.com/api/adserver/spt?AV_TAGID=[studio tag id]&AV_PUBLISHERID=[publisher id]"</script>>

** Important note: script id must match AV[tag id]. Meaning in this example id="AV5fdc6ff3ad9eb744ab2c91db"

Overriding Config

It is possible to override config by using data attributes

The use as follows:

  • Add attribute with “data-” prefix

  • Use - for uppercase letter: “data-abc-def“ will override config.abcDef

  • Use . for an object: “data-abc.def-ghi” will override config.abc.defGhi

  • Adding the following attribute: “data-ad-config.error-limit“=5 will set config.adConfig.errorLimit= 5

It is also possible to obtain and modify the player config before the player creation by adding the attribute:

data-config-api="configOverride"

window.configOverride = function (config) {
//config.soundButton = true; can be used to update the player config
}

Obtaining a Reference to the Player

In order to obtain a reference to the player, add the following attribute:

data-player-api="callbackFuncName"

window.callbackFuncName = function(config, player) {
//player is the player object
//player.on("AdImpression", function(data){}) can be used for example to listen to player events
}

An element with both override config and player call back may look like:

    <script async id="AV5fdc6ff3ad9eb744ab2c91db" type="text/javascript"
        src="https://tg1.aniview.com/api/adserver/spt?AV_TAGID=[studio tag id]&AV_PUBLISHERID=[publisher id]"
        data-player-api="callbackFuncName" data-config-api="configOverride"></script>
    <script>

Code example:

<script>
    var baseUrl = "https://tg1.aniview.com/api/adserver/spt?AV_TAGID=6409ab55392e5d6334057e03&AV_PUBLISHERID=6124992a9c738f3419721fb3";
    var sc = document.createElement("script");
    sc.id = "AV6409ab55392e5d6334057e03";
    sc.setAttribute("data-config-api", "configOverride");
    sc.setAttribute("data-player-api", "callbackFuncName");
    sc.src = baseUrl;
    document.body.appendChild(sc);
</script>
<script>
    window.configOverride = function (config) {

    }

    window.callbackFuncName = function (config, player) {
        // Impression event
        player.on("AdImpression", function (data) {
 
        })
        //Player stopped
        player.on("AdError", function(res){
          if(res && res.errorlimit) {
          
          }
        });
    }
</script>

  • No labels