A Youtube Api module for Angular 5 and above
Supplied in UMD Bundle format through NPM
https://www.npmjs.com/package/angularx-youtube
https://github.com/edwardpayton/angularx-youtube
To install this library, run:
$ npm install angularx-youtube --save
You can import the library in any Angular application by running:
$ npm install angularx-youtube --save
and then from your Angular AppModule
:
// In yout Module
// Import the Youtube Module
import { YoutubeModule } from 'angularx-youtube';
@NgModule({
...
imports: [
// Specify the library as an import
YoutubeModule
],
...
})
Once your module is imported, you can use it in your Angular application:
import { YoutubeComponent } from 'angularx-youtube';
<!-- You can now use the Youtube component in your app.component.html -->
<youtube-component
[videoId]="id"
(ready)="onReady($event)"
(change)="onChange($event)"
></youtube-component>
You will then have full access to the Youtube iFrame Api
For example:
onReady(player): void {
this.player = player;
}
onChange(event): void {
console.log(event)
}
MIT © Edward Payton