> Documentation-Index > Implementation Guide
Implementation Guideline
This part must be considered from two different perspectives.
Technically, the Ad Controller should:
But the Ad Controller has to consider business requirements too. For example, the Ad Controller build for the sample app should target the following goals:
function AdController() {
this.facade;
this.publisherAPI;
this.globalConfig;
this.environmentVars;
this.testAdBreak;
}
AdController.prototype.createPlayerFacade;
AdController.prototype.initSmartClientCore;
AdController.prototype.initAdEventListeners;
AdController.prototype.handleAdEvent;
AdController.prototype.requestAdSlot;
AdController.prototype.getDefaultAdBreak;
// For testing purpose...
AdController.prototype.applyAdSchedule;
AdController.prototype.enableDebug;
Extract from the adController.js :: ad controller interface definition.
Details about the methods and properties are documented inline of js/adController.js
.
Add the Ad Controller using a script tag in index.html
before the player API source file.
--- index.html
+++ index.html
<script type="text/javascript" crossorigin="anonymous" src="vendor_modules/smartclip/smartclientcore.min.js"></script>
<script type="text/javascript" crossorigin="anonymous" src="js/ceHtmlFacade.js"></script>
+ <script type="text/javascript" crossorigin="anonymous" src="js/adController.js"></script>
<script type="text/javascript" crossorigin="anonymous" src="js/main.js"></script>
Extract from the index.html :: Adding the ad module
Create instances of the AdController
and AdController.facade
.
--- js/main.js
+++ js/main.js
window.playerAPI = document.getElementById('myvid');
initHBBTV = function () {
//...
}
initHBBTV();
+ adController = new AdController();
+ adController.createPlayerFacade(window.playerAPI);
Extract from the main.js, line 90 ff. :: The sample app is being prepared for advertising.
Next: Initializing the first Ad Break
Prev: Safeguarding the Video Player
Top: Implementation Guide Overview