viscovery-ad-sdk-html5

Viscovery-html5-ad-sdk

Document of Viscovery AD SDK

Intro

Viscovery aims to help our video publishers to monetize their video content with content-relative ads. The whole adTech includes the integration of Viscovery’s FITAMOS computer vision recognition technology.

Resources

Get Started

Import

ViscoverySDK need to be import to your html file

<script type="text/javascript" src="{host}/visSDK.2.0.js"></script>

HTML Structure

Developer must fulfill following requests

HTML Structure Suggestion

HTML

<div id="container">
  <div id="content">
    <video id="content-player" class="player-layout" preload="metadata" width="854" height="480" playsinline controls>
      <source src="https://your.video.path"></source>
    </video>
  </div>
  <div id="adContainer"></div>
  <div id="outstream"></div>
</div>

*playsinline: you can refer Mobile Fullscreen Hacking section to understand why you should add playsinline attribute.

Style

#container {
  position: relative;
}

#adContainer {
  position: absolute;
  top: 0px;
  left: 0px;
}

Initialize SDK

<script type="text/javascript">
  window.onload = function () {
    viscoveryAd.init({
      contentPlayer: '#content-player',
      adContainer: '#adContainer',
      outStreamContainer: '#outstream',
      apiKey: 'your-api-key', 
      videoUrl: "https://your.video.path",
      videoId: 'video-id',
      playerControl: {
        // play: '',
        // pause: '',
        // getSeeking: '',
        // getCurrentTime: '',
        // getPaused: '',
      },
      bottomOffset: 30,
      mobileFullscreenHacking: true,
    });
  }
</script>

API Reference

init(args)

initialize Viscovery AD SDK

Arguments

*1 You can only give video url or video id. You will not get right ads if you give them both but they don’t match.

*2 if play, pause, seeking, currentTime or paused of your player don’t match native html5 video player property name, you should give SDK these by yourself.

Mobile Fullscreen Hacking

Due to limitation of mobile browser, Viscovery Ad SDK could not implement ad displaying on mobile browser. However, if mobileFullscreenHacking is true, Viscovery Ad SDK will achieve the fullscreen mode by implementing following specs.

Besides turning mobileFullscreenHacking into true, developer should add playsinline attribute to video tag.

Support player

Support Inventory size