Closed yashraj-02 closed 1 year ago
Anyone?
https://github.com/googleads/videojs-ima
<!-- Load dependent scripts -->
<script src="/path/to/video.js"></script>
<script src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="/path/to/videojs-contrib-ads.js"></script>
<script src="/path/to/videojs.ima.js"></script>
maybe ima3.js is missing from your script?
Nope. It is present.
@dioramayuanito
Hello @yashraj-02 ,
Would it be possible to reproduce this error using the plugin's sample apps?
Depending on where the try/catch is implemented, player.ima() may not be available.
Thank you, Jackson IMA SDK team
That’s the problem. The error is not reproducible on my side either. I am seeing this in error logs sent from client side from the actual users.
That’s the problem. The error is not reproducible on my side either. I am seeing this in error logs sent from client side from the actual users.
I have a feeling that your users "maybe" enabled an Ad Blocker
@dioramayuanito
script_1: core script
script_2: has videojs & videojs-ima code
Nice guess but that's not the case either. Because the core script (#script_1) gets blocked if an ad-blocker is present on the page. So the #script_2 never gets called.
@Kiro705 @dioramayuanito
the core script (#script_1) gets blocked if an ad-blocker is present on the page.
It is important to keep in mind that many different ad blockers exist, and may have completely different blocklists or fingerprints that they use to block certain resources. Just because one ad blocker prevents your #script_1 from loading does not mean that all will behave the same.
That said, player.ima
is first instantiated by the call on line #3778 of videojs-ima.js.
The operations that need to occur for player.ima
to exist are as follows:
videojs
must be loadedvideojs-ima.js
must have already been calledplayer
must be an instance of the videojs
player objectIf those conditions are all met, player.ima()
will exist. On first call, it will create an instance of the ImaPlugin
class. On subsequent calls, it will return the existing instance of ImaPlugin
. This "singleton-esque" behavior is what is occurring in the Init
function that you mentioned in your first post.
I would recommend testing your base assumptions by adding explicit logging code to verify each of the prerequisites that I listed above. I'd be willing to bet that for users who cannot access player.ima
, at least one of those bullets is false.
Thanks,
Greg Schoppe IMA SDK Team
Thanks.
Also, I raised this in videojs forum also. They recommended me to rearrange the imports this way.
video.js first, then contrib-ads, then ima
Currently, my imports are organized in this manner
Do you have any take on this?
Link to slack thread: https://videojs.slack.com/archives/C43LGP955/p1672309629213189?thread_ts=1672124949.828749&cid=C43LGP955
You definitely should reorder your imports, as they described, so as to match the order shown in the videojs-ima README file.
import videojs from 'video.js';
import 'videojs-contrib-ads';
import 'videojs-ima';
Thanks,
Greg Schoppe IMA SDK Team
Thanks @gschoppe. I am implementing this changes. I will update you guys here after we have the data in few days.
Do you guys have any idea regarding why does player.ima
gets converted into an object later? Like, initially it's a function but after a few milliseconds, it gets converted to an object.
do you initialize videojs-ima more than once? for multiple player?
Yup, I did that.
Do you guys have any idea regarding why does
player.ima
gets converted into an object later? Like, initially it's a function but after a few milliseconds, it gets converted to an object.
This is standard behavior for videojs plugins. You can read more about it in the videojs documentation.
Thanks,
Greg Schoppe IMA SDK Team
I am getting the
player.ima is not a function
error. Basically, I have added try catch to the entire function & the catch block is helping me to log the messages to my logging service.My guess is that the function
[new ImaPlugin(this, options);]
is not getting attached [to the player.ima] till the time I callplayer.ima(options)
Callstack