I try to implement VAST-ad, but it doesn't work. My code doesn't show VAST ad before playing video Here is my code:
var player = new MediaElementPlayer('#id', {
playsInline: true,
vastAdTagUrl: 'url',
vastEnableSkip: true,
vastSkipSeconds: 3,
features: ['vast'],
vastAdsType: 'vast',
success: function(media, node, playerElement) {
}
});
Here is links:
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="mediaelement-and-player.js"></script>
<link rel="stylesheet" href="mediaelementplayer.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/mediaelement-plugins/2.5.0/ads/ads.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/mediaelement-plugins/2.5.0/ads/ads.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mediaelement-plugins/2.5.0/ads-vast-vpaid/ads-vast-vpaid.js"></script>
I have this error in Console:
Uncaught TypeError: Cannot set property 'mejs.ad-skip' of undefined at Object.1 (ads.js:14)
Late Answer:
What is the exact url in your code vastAdTagUrl: 'url'?
It needs to be xml. For the sample of xml, you can go to: https://github.com/InteractiveAdvertisingBureau/VAST_Samples/blob/master/VAST%203.0%20Samples/Video_Clicks_and_click_tracking-Inline-test.xml
Also, for the features, need to have ads too: features: ['vast','ads'],