Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adsready event not triggered #490

Open
snowiesuet opened this issue Jun 30, 2019 · 0 comments
Open

adsready event not triggered #490

snowiesuet opened this issue Jun 30, 2019 · 0 comments

Comments

@snowiesuet
Copy link

Hello I'm having a similar issue as this. The only difference is I'm currently using VueJs.
VIDEOJS: ADS: Received adsready event (BeforePreroll) is never called and my video content plays right away without any ads. There is no error in the console at all.

Heres my code:

import videojs from "video.js";
require("videojs-contrib-ads/dist/videojs-contrib-ads.js");

require("video.js/dist/video-js.css");
require("videojs-contrib-ads/dist/videojs.ads.css");

mounted() {
    this.player = videojs(
      this.$refs.videoPlayer,
      this.options,
      function onPlayerReady() {
        var player = this;
        this.ads({
          playPreroll: true,
          debug: true
        });
        player.on("contentupdate", function() {
          // Never triggered
          console.log("contentupdate");
          player.trigger("adsready");
        });

        player.on("readyforpreroll", function() {
          // Never triggered
          console.log("readyforpreroll");
          player.ads.startLinearAdMode();
          player.src(
            "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4"
          );
          player.one("adended", function() {
            console.log("adended");
            player.ads.endLinearAdMode();
          });
        });
        // For logging/debugging purposes
        var evs = [
          "adtimeout",
          "contentplayback",
          "adsready",
          "adstart",
          "adend",
          "adskip",
          "timeupdate"
        ];

        evs.map(function(ev) {
          player.on(ev, function() {
            console.log("[PLAYER LOG]: %s", ev);
          });
        });
      }
    );
  }

Here's my log once I play the video:

VIDEOJS: ADS: Using playMiddleware to block content playback
VIDEOJS: ADS: Play call to Tech was terminated.
VIDEOJS: ADS: Received play event (BeforePreroll)
VIDEOJS: ADS: BeforePreroll -> Preroll
VIDEOJS: ADS: adtimeout (Preroll)
[PLAYER LOG]: adtimeout
VIDEOJS: ADS: Preroll -> ContentPlayback
[PLAYER LOG]: timeupdate

My packages are of the latest versions.
Any help would be appreciated. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant