Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'unsubscribe' of undefined #888

Open
g-hamilton opened this issue Mar 6, 2020 · 2 comments
Open

TypeError: Cannot read property 'unsubscribe' of undefined #888

g-hamilton opened this issue Mar 6, 2020 · 2 comments

Comments

@g-hamilton
Copy link

g-hamilton commented Mar 6, 2020

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: Angular Universal Intergration #653

Attachments

Follow steps above to see error.

@leojkwan
Copy link

leojkwan commented Oct 5, 2020

same issue

@leojkwan
Copy link

leojkwan commented Oct 5, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants