nkoehler / mat-video

:tv: mat-video is an Angular 8/9+ video player using Material!
https://nkoehler.github.io/mat-video/
MIT License
91 stars 47 forks source link

GetvideoTag() not working. #57

Open Shivampio opened 4 years ago

Shivampio commented 4 years ago

AppComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Cannot read property '__zone_symbol__addEventListener' of null

honest-studio commented 4 years ago

Same error!!! image

Angular CLI: 9.1.4 Node: 12.16.2 OS: win32 x64

Angular: 9.1.4 ... animations, cli, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.901.4 @angular-devkit/build-angular 0.901.4 @angular-devkit/build-optimizer 0.901.4 @angular-devkit/build-webpack 0.901.4 @angular-devkit/core 9.1.4 @angular-devkit/schematics 9.1.4 @angular/cdk 9.2.2 @angular/material 9.2.2 @ngtools/webpack 9.1.4 @schematics/angular 9.1.4 @schematics/update 0.901.4 rxjs 6.5.5 typescript 3.8.3 webpack 4.42.0

jboz commented 4 years ago

I had this problem and I solved it using ngAfterViewInit like this :

@ViewChild('lessonVideo')
private matVideo: { getVideoTag: () => HTMLVideoElement };

[...]

ngAfterViewInit(): void {
  this.matVideo.getVideoTag().addEventListener('ended', () => this.store.dispatch(new ReadNextVideo()));
}

I can't import MatVideoComponent 😢 :

import { MatVideoComponent } from 'mat-video'; // <= Module '"node_modules/mat-video/mat-video"' has no exported member 'MatVideoComponent'.

so I describe it's interface :

{ getVideoTag: () => HTMLVideoElement }

And it's work ! 😄

Shivampio commented 4 years ago

Thanks for your reply, i will try it definitely.