MKOMSDK Plugin is a web plugin for MKPlayer Web SDK for AD Verification on streaming assets. This plugin is based on iab Tech Lab Open Measurement SDK. For more details, please visit www.iabtechlab.com/standards/open-measurement-sdk.
The main usage of this plugin is to easily add AD Verification on the streamed assets (both LIVE and VOD), while using the MKPlayer Web SDK.
Initial Setup
The OM SDK has two parts:
One can include these two files into their web app by themselves using script tag (if they have their own) and pass false for autoLoadScript (4th constructor argument).
Integrations must not concatenate or compile the Service Script omweb-v1.js into other scripts. It will not work correctly unless loaded in its own <script> tag.
The JS Session Client can be compiled into your site’s scripts directly, with systems like CommonJS or the Closure Compiler.
OR
Pass both the file paths as MKOMSDK configuration params to the MKOMSDK plugin else the plugin will use the default scripts.
const mkOMSDKconfig = {
partnerName: "<PARTNER_NAME>",
partnerVersion: "<PARTNER_VERSION>",
serviceScriptUrl: "<OMSDK_SERVICE_SCRIPT_URL>", // <optional>
validationScriptUrl: "<OMSDK_VALIDATION_SCRIPT_URL>" // <optional>
}
Install plugin
npm install @mediakind/mkplayer-omsdk-plugin
Import plugin
import { MKOMSDKController, MKOmSdkConfig, omsdkErrorDataType }
from "@mediakind/mkplayer-omsdk-plugin";
Define MKOMSDK Error Callback Method
/** MKOMSDK error callback method */
const mkOMSDKErrorCallback = function (data: omsdkErrorDataType) {
console.log("MKOMSDK Error Data ", data);
}
Initialize MKPlayer Web SDK
/** Initialize player */
const player = new mkplayer.MKPlayer(videoContainer, playerConfig);
In the code after initializing MKPlayer Web SDK, define MKOmSdkConfig and pass it to the MKOMSDK controller along with error callback.
/** MKOMSDK Config.*/
const mkOMSDKconfig = {
partnerName: "<PARTNER_NAME>",
partnerVersion: "<PARTNER_VERSION>",
serviceScriptUrl: "<OMSDK_SERVICE_SCRIPT_URL>", // <optional>
validationScriptUrl: "<OMSDK_VALIDATION_SCRIPT_URL>" // <optional>
}
const omsdkController = new MKOMSDKController(player, mkOMSDKErrorCallback, mkOMSDKconfig);