Description
I encountered these 2 errors:
preview-9c596f222c88a.js:2 ERROR TypeError: Cannot read properties of undefined (reading 'subscriptions')
at VgOverlayPlayComponent.onPlayerReady (vg-overlay-play.component.ts:127:4)
at eval (vg-overlay-play.component.ts:109:53)
ERROR TypeError: Cannot read properties of undefined (reading 'play')
at VgControlsComponent.onPlayerReady (vg-controls.component.ts:102:4)
at eval (vg-controls.component.ts:88:53)
This happens when the video player is created when entering a component but "destroyed" before onPlayerReady is called.
It can happen in a real app when user will go on a route but immediately click on another link to go on another route, in this scenario, the player would have started to create but will be destroyed directly.
The problems seems to come from vg-overlay-play & vg-controls
Workaround
When you get onPlayerReady event, start to create <vg-overlay-play> & <vg-controls>, i.e:
<vg-player (onPlayerReady)="onPlayerReady($event)">
<ng-container *ngIf="isPlayerReady">
<vg-overlay-play
[vgFor]="identifier"
></vg-overlay-play>
<vg-controls [vgAutohide]="true" [vgAutohideTime]="1">
<vg-play-pause></vg-play-pause>
</vg-controls>
</ng-container>
<video
[vgMedia]="$any(vgMedia)"
#vgMedia
[id]="identifier"
>
<source #vgMediaSource [src]="sourceSelectedByDefault" type="video/mp4" />
</video>
</vg-player>
public isPlayerReady: boolean = false;
public onPlayerReady(api: VgApiService): void {
this.api = api;
setTimeout((): void => {
this.isPlayerReady = true;
});
}
I'm guessing the fix is simply to add a if statement somewhere in the overlay and controls component...
Expected Behavior
No exception is raised in this scenario
Actual Behavior
THere were 2 exceptions being thrown
Steps to Reproduce
I created this stackblitz that "fake" the behaviour I described above, there is a ExpressionChangedAfterItHasBeenCheckedError because of the way I "faked" the reproduction but you also see the videogular errrors
https://ngx-ui-scroll-3-angular-16-jq9qdj.stackblitz.io
Thanks for this great component
Description
I encountered these 2 errors:
This happens when the video player is created when entering a component but "destroyed" before
onPlayerReadyis called.It can happen in a real app when user will go on a route but immediately click on another link to go on another route, in this scenario, the player would have started to create but will be destroyed directly.
The problems seems to come from
vg-overlay-play&vg-controlsWorkaround
When you get
onPlayerReadyevent, start to create<vg-overlay-play>&<vg-controls>, i.e:onPlayerReady:I'm guessing the fix is simply to add a
ifstatement somewhere in the overlay and controls component...Expected Behavior
No exception is raised in this scenario
Actual Behavior
THere were 2 exceptions being thrown
Steps to Reproduce
I created this stackblitz that "fake" the behaviour I described above, there is a
ExpressionChangedAfterItHasBeenCheckedErrorbecause of the way I "faked" the reproduction but you also see the videogular errrorshttps://ngx-ui-scroll-3-angular-16-jq9qdj.stackblitz.io
Thanks for this great component