cladera / videojs-offset

VideoJS plugin for play a segment of a video.
MIT License
64 stars 43 forks source link

Cannot read property 'registerPlugin' of undefined in Angular2 #38

Closed adsl99801 closed 5 years ago

adsl99801 commented 5 years ago

I want to use this plugin in angular7 but something go wrong. angular.json 3 import videojs from 'video.js'; this.player = videojs('nowVideo');

1 2

Uncaught TypeError: Cannot read property 'registerPlugin' of undefined at videojs-offset.js:19

How to fix?

cladera commented 5 years ago

Hi @adsl99801 ,

Yes, you are right it does not work as it suposed to work in projects managed by angular cli. I'll investigate further.

In the meantime, a solution would be to include videojs as a global script as well.

Try something like this in your angular.json:

...
"scripts": [
   "node_modules/video.js/dist/video.js",
   "node_modules/videojs-offset/dist/videojs-offset.js"
]
...

Also remove any import videojs from "video.js" in you modules/components and start using videojs as global. For example use window['videojs'].

Does it make sense for you?

cladera commented 5 years ago

I'm closing this issue due to inactivity.