VideoJS IMA设置

时间:2017-07-25 03:24:57

标签: video.js

我正在尝试按照https://github.com/googleads/videojs-ima上的GettingStarted说明使用ima设置videojs。但是,我被困在“在播放器.js中,加载广告库”的部分;本地player.js文件中没有任何更改,因此它看起来仍然与此处https://github.com/videojs/video.js/blob/master/src/js/player.js完全相同。

Bellow是我当前的代码,但是当它在IE11中运行时,控制台会报告一个警告和两个错误:

  1. 警告:“VIDEOJS:警告:不推荐使用videojs.plugin();而是使用videojs.registerPlugin()代替”在video.js(489,5)
  2. 错误:“player.js(5,1)
  3. 中的”SCRIPT1002:语法错误“
  4. 错误:视频-js.css中的“CSS3120:@ font-face规则没有可用的字体”(12,7)
  5. 非常感谢任何输入。

    谢谢。

    <!DOCTYPE html>
    <html>
        <head>
            <!-- Load dependent stylesheets. -->
            <link rel="stylesheet" href="http://vjs.zencdn.net/6.2.0/video-js.css">
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/5.0.2/videojs.ads.css" />
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/videojs-ima/0.6.0/videojs.ima.css" />
        </head>
    
        <body>
            <video id="content_video" class="video-js vjs-default-skin"
                    controls preload="auto" width="440" height="260">
                <source src="//vjs.zencdn.net/v/oceans.mp4" type="video/mp4" />
            </video>
            <!-- Load dependent scripts -->
            <script src="http://vjs.zencdn.net/6.2.0/video.js"></script>
            <script src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
            <script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/5.0.2/videojs.ads.js"></script>
            <script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-ima/0.6.0/videojs.ima.js"></script>
            <script src="src/js/player.js"></script>
            <script>
                var player = videojs('content_video');
    
                var options = {
                  id: 'content_video',
                  adTagUrl: 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=440x260&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator='
                };
    
                // This must be called before player.play() below.
                player.ima(options);
                player.ima.requestAds();
                // On mobile devices, you must call initializeAdDisplayContainer as the result
                // of a user action (e.g. button click). If you do not make this call, the SDK
                // will make it for you, but not as the result of a user action. For more info
                // see our examples, all of which are set up to work on mobile devices.
                // player.ima.initializeAdDisplayContainer();
    
                // This must be called after player.ima(...) above.
                player.play();      
            </script>
        </body>
    </html>
    

0 个答案:

没有答案