I am faced with the challenge of integrating video.js into my IonicFramework application built using Angular. I attempted to install it via npm
, but encountered issues with TypeScript recognizing any importable module, and was unable to find clear documentation on incorporating it into TS/ES6 applications.
To work around this, I tried treating video.js as a regular JavaScript library. I added the video.js script to my index.html
file:
<script src="assets/js/video_v6_6_3.js"></script>
Upon inspection, the script declares a function called videojs
in the global scope (a practice that I find less than ideal).
In my application, I attempted to call this function within the ngAfterViewInit
method like so: videojs(this.videoId);
. However, during runtime, TypeScript threw an exception:
Typescript Error
Cannot find name 'videojs'.
Is there a way to package such libraries for seamless integration with Angular's importing system? Or perhaps a method to prevent TypeScript from throwing errors when using these kinds of functions? I have searched extensively but found no resources addressing this specific scenario.