videojs / videojs-contrib-ads

A Tool for Building Video.js Ad Plugins
http://videojs.github.io/videojs-contrib-ads/
Other
381 stars 257 forks source link

VIDEOJS: ERROR: videojs-contrib-ads has not seen a loadstart event 5 seconds after being initialized, but a source is present. This indicates that videojs-contrib-ads was initialized too late. It must be initialized immediately after video.js in the same tick. As a result, some ads will not play and some media events will be incorrect. For more information, see http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html #505

Open brunofournies opened 4 years ago

brunofournies commented 4 years ago

HI guys, i'm having trouble to set up the IMA plugin in Videojs (https://github.com/googleads/videojs-ima), I'm still getting the error

VIDEOJS: ERROR: videojs-contrib-ads has not seen a loadstart event 5 seconds after being initialized, but a source is present. This indicates that videojs-contrib-ads was initialized too late. It must be initialized immediately after video.js in the same tick. As a result, some ads will not play and some media events will be incorrect. For more information, see http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html

But the weird thing is that sometimes that error disappear and the ads are showing properly for no reason. This is my html set up:

<!DOCTYPE html>
<html dir="ltr" lang="es-cl">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="SemiColonWeb" />
<link href="https://vjs.zencdn.net/7.6.5/video-js.css" rel="stylesheet">
<link href=https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.6.5/videojs-contrib-ads.css rel="stylesheet">
<link href=https://cdnjs.cloudflare.com/ajax/libs/videojs-ima/1.7.0/videojs.ima.css rel="stylesheet">
</head>
<body>
<video id="player" class="video-js vjs-big-play-centered vjs-fluid"  playsinline controls preload="none" data-setup='{}'>
    <source src="{{ urlvideo }}" type="application/x-mpegURL">
    <p class='vjs-no-js'>
        To view this video please enable JavaScript, and consider upgrading to a web browser that
        <a href='https://videojs.com/html5-video-support/' target='_blank'>supports HTML5 video</a>
        </p>
</video>                      
<script src='https://vjs.zencdn.net/7.6.5/video.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.6.5/videojs-contrib-ads.js"></script>
<script src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-ima/1.7.0/videojs.ima.js"></script>
<script>                        
    var player = videojs('player');
    var options = {
        adTagUrl: 'Adurl'        
        };
        player.ima(options);
        player.on('error', function() {
            player.error(null);
            // Modals are temporary by default. They dispose themselves when they are
            // closed; so, we can create a new one each time the player is paused and
            // not worry about leaving extra nodes hanging around.
            var modal = player.createModal('La cámara sólo funcionará desde las 7 AM hasta las 21 PM, asi ahorramos energía :). Si necesitas otro horario, escríbenos por instagram y hablamos!');
        });
    </script>   
</body>
</html>

Any idea of why im having ths issue?

Thanks guys!

jszoja commented 4 years ago

Getting the same problem in Chrome. Replicating regularly when opening first chrome window - new user session.

My HTML:

<video-js ... > 
[...] 
$(function {  // jQuery document.onReady

   var bcplayer = bc("ooyalaplayer");
   // [...]
}
// [...]
<script src="https://service.videoplaza.tv/proxy/pulse-sdk-html5/2.1/latest.min.js"></script>
<script src="https://service.videoplaza.tv/proxy/pulse-sdk-html5-skin/base.min.js"></script>
<script src="https://service.videoplaza.tv/proxy/pulse-sdk-html5-bridges/videojs/3/latest.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.6.5/videojs-contrib-ads.min.js"></script>