bitmovin / bitmovin-player-ui

The Bitmovin Adaptive Streaming Player UI
MIT License
126 stars 87 forks source link

'ads' namespace in Player instance is null #222

Closed eneskaya closed 5 years ago

eneskaya commented 5 years ago

I want to schedule ads in the bm player (v8.2.1). Setup is following:

import BitmovinEngineModule from 'bitmovin-player/modules/bitmovinplayer-engine-bitmovin'
import XMLModule from 'bitmovin-player/modules/bitmovinplayer-xml'
import AdvertisingCore from 'bitmovin-player/modules/bitmovinplayer-advertising-core'
import AdvertisingBitmovin from 'bitmovin-player/modules/bitmovinplayer-advertising-bitmovin'
import AdvertisingIma from 'bitmovin-player/modules/bitmovinplayer-advertising-ima'

...

Player.addModule(BitmovinEngineModule)
Player.addModule(XMLModule)
Player.addModule(AdvertisingCore)
Player.addModule(AdvertisingBitmovin)
Player.addModule(AdvertisingIma)
this.playerInstance = new Player(this.playerElem, this.playerConfig)

...

// And later calling the schedule method
private scheduleAd(properties: AdBreakConfig) {
  this.playerInstance.ads.schedule(properties)
}

Then I get the following error:

player.ts?9f2a:75 Uncaught TypeError: Cannot read property 'schedule' of null
    at default_1.scheduleAd (player.ts?9f2a:75)
    at eval (player.ts?9f2a:44)
    at default_1.emit (bus.ts?e9c7:55)
    at default_1.eval (watcher.ts?01a6:246)
    at step (watcher.ts:43)
    at Object.eval [as next] (watcher.ts:24)
    at fulfilled (watcher.ts:15)

The ads property of the player instance is always null. Help is appreciated!

dweinber commented 5 years ago

Hi, As this is not related to this UI repo, I'm going to close this issue. Feel free to reach out to support@bitmovin.com for general player issues.

However, I think your playerConfig does not contain an advertising config. It's required to "enable" advertising support, even if it's just an empty object.

eneskaya commented 5 years ago

Thanks, that was the issue 👍