videogular2 icon indicating copy to clipboard operation
videogular2 copied to clipboard

TypeError: Cannot read property 'unsubscribe' of undefined

Open g-hamilton opened this issue 4 years ago • 2 comments

Description

I'm getting the error: "TypeError: Cannot read property 'unsubscribe' of undefined" when I refresh a page containing the video player. I'm using Angular 8 Universal (with SSR). I found what I think is a related issue (#653), and that's marked as solved but I'm still getting the error. I've done a workaround using the platform type check and only show the player on the browser, but I'd like search engine bots to be able to index the video if possible.

Expected Behavior

Page should load and refresh with no error.

Actual Behavior

Page loads fine. Video plays fine. If user hits refresh on their browser while on a page containing a video player, the error occurs.

Steps to Reproduce

  1. As listed here: https://github.com/videogular/videogular2/issues/653

Attachments

Follow steps above to see error.

g-hamilton avatar Mar 06 '20 08:03 g-hamilton

same issue

leojkwan avatar Oct 05 '20 15:10 leojkwan

workaround is to wrap video player in isPlatformBrowserCheck:

<div *ngIf="isPlatformBrowser">
      <vg-player>
        <video [vgMedia]="media" #media id="singleVideo" preload="auto" controls>
          <source src="http://static.videogular.com/assets/videos/videogular.mp4" type="video/mp4">
        </video>
      </vg-player>
</div>

isPlatformBrowser is a boolean property you store on the component. https://angular.io/api/common/isPlatformBrowser

leojkwan avatar Oct 05 '20 15:10 leojkwan