I get "Uncaught TypeError: player.ima is not a function"
See original GitHub issueHi,
I always get this error “Uncaught TypeError: player.ima is not a function” but I don’t know why. Anyone can help me ?
ads.js code
var player = videojs('content_video');
var options = {
id: 'content_video',
adTagUrl: 'http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&' +
'iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&' +
'impl=s&gdfp_req=1&env=vp&output=xml_vmap1&unviewed_position_start=1&' +
'cust_params=sample_ar%3Dpremidpostpod%26deployment%3Dgmf-js&cmsid=496&' +
'vid=short_onecue&correlator='
};
player.ima(options);
// Remove controls from the player on iPad to stop native controls from stealing
// our click
var contentPlayer = document.getElementById('content_video_html5_api');
if ((navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)) &&
contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
// Initialize the ad container when the video player is clicked, but only the
// first time it's clicked.
var startEvent = 'click';
if (navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)) {
startEvent = 'touchend';
}
player.one(startEvent, function() {
player.ima.initializeAdDisplayContainer();
player.ima.requestAds();
player.play();
});
my php code
<link href="//vjs.zencdn.net/5.3/video-js.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/4.2.6/videojs.ads.css" />
<link rel="stylesheet" href="css/videojs.ima.css" />
<video id="content_video" class="video-js vjs-default-skin" controls autoplay preload="auto" height="400"
poster="img/<?php echo $element['img_normal']; ?>" data-setup="{}">
<source src="video/<?php echo $element['video']; ?>" type='video/mp4'>
</video>
<script src="https://s0.2mdn.net/instream/video/client.js" async="" type="text/javascript"></script>
<script src="//vjs.zencdn.net/5.10.7/video.js"></script>
<script src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/4.2.6/videojs.ads.min.js"></script>
<script type="text/javascript" src="script/videojs.ima.js"></script>
<script type="text/javascript" src="script/ads.js"></script>
Sorry for my bad english.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
I get "Uncaught TypeError: player.ima is not a function" #345
It appears that your code is trying to initialize the Google IMA plugin multiple times. You should make sure that this.player.ima(options); only ...
Read more >Videojs-ima plugin with requirejs not including plugins on load
You probably have initialized player.ads yourself (not provided in question) and IMA expect player.ads to be a function, what it is before ...
Read more >VideoJS IMA Plugin is failing on Crunchyroll...but only on Chrome : r ...
It just gives me the error "Uncaught (in promise) TypeError: player.ima is not a function". Bizarrely, it works just fine in Firefox.
Read more >IMA SDK v3 for Video.js - Google Groups
I am trying to start a preroll with no sound. setVolume(0) works fine, but the controlbar´s CSS is not correct. The mute-button and...
Read more >Resolve VAST and IMA SDK errors - Google Ad Manager Help
Behavior varies by player implementation. error, Fatal errors likely stopped the ad request. Warning, Potentially non-fatal errors may have continued to play ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I sorted it out. Spent a lot of time on the blogs, tried a inch of solutions and then everything and tried again. Last attempt got it all working.
On Tue, Jun 19, 2018, 4:46 PM Shawn Busolits notifications@github.com wrote:
Having the same issue…there should be one npm install that gets you everything you need. Obviously, the ima library cannot be found.