1.0.2 • Published 8 years ago
spotx-directados v1.0.2
SpotX Direct AdOS
This is the official SpotX Direct AdOS module.
Direct AdOS documentation can be found in the SpotX Developer Center
Installation and Usage
npm install @spotx/directados
To include the module in a script:
var SpotX = require("@spotx/directados");Example Usage:
Create a new directory for this sample project. Be sure to run npm install @spotx/directados in this new directory, if you haven't already.
Use the following browserify command to create a bundle.js file:
npx browserify --require @spotx/directados --outfile bundle.js
Create the following index.html file:
<!DOCTYPE HTML>
<html>
  <head></head>
  <body>
      <div id="video-container">
        <div id='video-content'>
          <video controls id="video-player" height="360" width="640"></video>
        </div>
    </div>
    <script src="bundle.js"></script>
    <script>
        (function() {
            var SpotX = require("@spotx/directados");
            var adContainer = document.getElementById('video-content');
            var directAdOS = new SpotX.DirectAdOS({
                channel_id: 85394,
                slot: adContainer,
                video_slot: document.getElementById('video-player'),
            });
            directAdOS.loadAd();
        })();
    </script>
  </body>
</html>Serve the index file locally:
python2 -m SimpleHTTPServer
or
python3 -m http.server
and navigate to the index.html page locally (usually http://localhost:8000). You should see a SpotX pre-roll video ad.