question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

this.vjsPlayer.ads is not a function (no adBlock)

See original GitHub issue

Hi! Didnt understand why it is so, but:

bundle.js:100686 Uncaught TypeError: this.vjsPlayer.ads is not a function at new PlayerWrapper (bundle.js:100686) at new Controller (bundle.js:102509) at new ImaPlugin (bundle.js:103132) at Player.init (bundle.js:103302) at Player.basicPluginWrapper [as ima] (bundle.js:27984) at Object.<anonymous> (bundle.js:62424) at webpack_require (bundle.js:20) at exports.__esModule (bundle.js:63) at bundle.js:66

This error is displayed both in FF and Chrome.

webpack.config.js:

const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  module:{
   loaders: [
     {test : /\.css$/,
       loader: 'style!css!'},
     {loader: 'url-loader?limit=100000',
     test: /\.(png|woff|woff2|eot|ttf|svg)$/
}
   ]
 },
 resolve: {
  alias: {
    webworkify: 'webworkify-webpack-dropin'
  }

index.js:

import videojs from 'video.js';
import * as HLS from 'videojs-contrib-hls';
window.videojs = videojs;

import 'videojs-contrib-ads';
import 'videojs-ima';


require('!style-loader!css-loader!video.js/dist/video-js.css');
require('!style-loader!css-loader!videojs-contrib-ads/dist/videojs.ads.css');
require('!style-loader!css-loader!videojs-ima/dist/videojs.ima.css');


let player = videojs('rbc');
let options = {
  id: 'rbc',
  adTagUrl: '//data.videonow.ru/?profile_id=1634796&format=vast&container=preroll'
};

  player.ima(options);

index.html:

<video id="rbc" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268" data-setup='{}'>
    <source src="https://online-video.rbc.ru/online/rbctv.m3u8" type="application/x-mpegURL">
  </video>

  <script src="dist/bundle.js"></script>

“Cloud” version of scripts works well, but my bundle.js - no.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
shawnbusocommented, Jan 2, 2018

Thanks for the info - filing as an FR to import contrib-ads via a module system.

3reactions
incomplcommented, Dec 29, 2017

I think ultimately the right solution for this is for the videojs-contrib-ads dependency to be imported using a module system by videojs-ima. I created an example of how to do this:

https://github.com/videojs/videojs-contrib-ads/pull/312/files

Read more comments on GitHub >

github_iconTop Results From Across the Web

VideoJs Ads Referenced Error on Basic Setup - Stack Overflow
Uncaught TypeError: player.ads is not a function. but if you will look into the example on GitHub, you just need to reference the...
Read more >
videojs-contrib-ads
In order to function correctly, videojs-contrib-ads must be initialized immediately after video.js (in the same tick). This is for two reasons:.
Read more >
video-js.ima-ad - Forum - Adblock Plus
here is the page I am trying to get the video player to function correctly on. I have tested it with no extensions...
Read more >
Video.js Plugins
A framework that provides common functionality needed by video advertisement libraries working with video.js. generator-videojs-plugin. 150 8.0.0.
Read more >
Purple Ads Blocker
Purple AdBlock is a video ad-blocker for Twitch.tv. ... The extension does not collect or store your personal information and is opensource.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found