How can I access the IMA-SDK of HTML5 player
In Version 8 (exactly since 8.14.0
) of the Bitmovin web-player-sdk
you can directly access the default Advertisings Module which is the IMA-SDK from Google.
How would you do this?
Our Player offers several callbacks for that:
- beforeInitialization - Callback that provides access to the
google.ima.ImaSdkSettings
before any initialization happens. A possible use of this could be to change the locale of the ads - onAdContainerAvailable - Callback that provides access to the ad container HTML-Element.
- onAdsManagerAvailable - This callback passes the
google.ima.AdsManager
as you will see in the next example:
Example
const playerConfig = {
key: '<KEY>',
advertising: {
adBreaks: [
{
tag: {
url:'<VAR-URL>',
type: 'vast'
},
id: 'Ad',
position: 'pre'
}
],
onAdsManagerAvailable : (IMAAdManager) => {
// example of IMA AdManager usage
IMAAdManager.addEventListener( google.ima.AdEvent.Type.AD_PROGRESS, (IMAEvent) => {
var adProgressData= IMAEvent.getAdData();
console.log(parseInt(adProgressData.duration)-parseInt(adProgressData.currentTime));
});
}
}
};
Updated about 1 year ago