Skip to content

Error unmounting component: "TypeError: Cannot read property 'disablePIP' of undefined" #849

Description

@iniq

Current Behavior

When the screen is quickly refreshed or redirected before the player is fully initialized, an exception is thrown with the message "TypeError: Cannot read property 'disablePIP' of undefined" and the player fails to unmount.

Expected Behavior

The player unmounts.

Steps to Reproduce

We have not been able to reliably trigger it every time, but it is reasonably consistent with these steps:

  1. Have a screen with one or more player components included start to render
  2. The user clicks a button to cause a redirect before the player is fully initialized

Environment

  • URL attempting to play: any
  • Browser: Google Chrome, Safari, Microsoft Edge (possibly others)
  • Operating system: Mac OS, Windows (possibly others)
  • jsFiddle example:

Other Information

We believe the issue is caused here:
https://github.com/CookPete/react-player/blob/a4e89c0f9e0ad10dac4e57ea2cae670a7ffd29d3/src/Player.js#L32

In our debugging we believe we found that if this line is called before this.player is created and initialized, the exception is thrown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions