
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
ima-ad-player
Advanced tools
Yet another Google IMA HTML5 SDK video ad player.
Add the ad player script to your HTML :
<head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ima-ad-player@latest/dist/ima-ad-player.min.js"></script>
</head>
Then use the ImaAdPlayer factory to create ad player instance :
ImaAdPlayer({
video: document.querySelector('.a-video-element'),
displayContainer: document.querySelector('.a-display-container-element'),
tag: 'https://myadserver.com/path/to/vast/tag.xml',
}, function(player, error) {
if (error) {
// Ad player creation failed
return console.log(error);
}
player.on('ad_begin', function() {
// Pause content video
});
player.on('ad_end', function() {
// Play or resume content video
});
// Must be done as the result of a user action (if autoplay not permitted)
player.play();
});
The ad player assumes the ad display container and video element are correctly positioned and sized.
For a complete example see the HTML development page.
Ad player default behaviour is to assumes that play() method is called when video is allowed to autostart. (ie: autoplay is permitted or called after user interaction)
For that reason, default internal behaviour is to call setAdWillAutoPlay(true) and setAdWillPlayMuted(false) on IMA AdsRequest instance.
It can be changed using adWillAutoPlay and adWillPlayMuted configuration options.
Add it to your project, for example, using NPM command :
$ npm install ima-ad-player
Then import and use ad player factory :
import ImaAdPlayer from 'ima-ad-player'
ImaAdPlayer({
// ...
}, function(player, error) {
// ...
});
This library is basically a wrapper on IMA SDK library. The goal is to provide a simple implementation which cover common ad scenarios.
I created this project because I needed to implement the IMA SDK in several other projects without having to duplicate the implementation code.
It is used in the following projects :
The MIT License (MIT). Please see License File for more information.
FAQs
Yet another Google IMA video ad player.
We found that ima-ad-player demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.