videojs / videojs-contrib-hls

HLS library for video.js
http://videojs.github.io/videojs-contrib-hls/
Other
2.84k stars 792 forks source link

Help doc with Angular 5 #1346

Closed CalibanAngel closed 6 years ago

CalibanAngel commented 6 years ago

Hi

I was trying to use videojs and video-contrib-hls with Angular 5 and it didn't work at all. So after trying few things I finally succeed to use it. So this is what I did to fix my problems.

I use in my package.json :

"devDependencies": { 
        "video.js": "^6.6.3" 
}
"dependencies": { 
        "videojs-contrib-hls": "^5.12.2" 
} 

Actually i don't know for others version but it works with these one.

You should add in angular-cli.json :

"script": [
        "../node_modules/video.js/dist/video.min.js",
        "../node_modules/videojs-contrib-hls/dist/videojs-contrib-hls.min.js"
]

And in your my-component.component.ts :

import ...
declare var videojs: any;

I hope it will help someone.

gaglage commented 6 years ago

Thanks a lot. I'll chek it because I'll need it soon. Only a consideration the property in angular-cli.json "scripts" .

gesinger commented 6 years ago

Thanks for sharing @CalibanAngel . Going to close this ticket though as it isn't a current issue.

vakuzmin commented 6 years ago

please don't forget to include as well

"../node_modules/video.js/dist/video-js.min.css",

moreover here is the link to the custom component guide

https://www.arroyolabs.com/2017/03/angular-2-videojs-component/

lahbib commented 5 years ago

import { videojs } from "video.js";

is the simplest way :)