javascript - 通过 require.js 谷歌 ima3.js

标签 javascript requirejs google-ima

如何包含 Google 库 ima3.js使用 require.js 到我的模块?

我正在尝试这样,但没有成功:

define(['uiBase', 'base', 'const', 'https://s0.2mdn.net/instream/html5/ima3.js'], function (UIBase, Base, Const, AdSDK) {
function Ad (params) {
    var params = params || {};

    /*-- Section to build ui elements --*/
      var adsLoader = new AdSDK.google.ima.AdsLoader(adDisplayContainer);
    /*-- End of section --*/
    };
return Ad;
});

最佳答案

我找到了答案。如果它对某人有用:所有这些代码都可以正确工作,只是为了调用 ima 函数,我需要将它们称为:

var adsLoader = new google.ima.AdsLoader(adDisplayContainer);

关于javascript - 通过 require.js 谷歌 ima3.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24512458/

相关文章:

javascript - 加载链接后的 Jquery,滚动到顶部

node.js - 视频 : playing a pre-roll add before each playlist item

admob - Google Interactive Media Ads (IMA) 和 Google AdMob 之间的区别

javascript - 使用 require.js 和 testr.js 启动并运行

javascript - 测试 angularJS 应用程序时出现 Karma "not found"错误

javascript - onload 事件在内容加载前触发

JavaScript 在 codeigniter 中不起作用?

javascript - RequireJS 优化器 - 一个 JS 文件与整个项目

javascript - ES6 动态 Import() 与 AMD require()