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

Youtube & Vimeo provider throw provider destroyed error #1459

Open
Benny739 opened this issue Oct 6, 2024 · 2 comments
Open

Youtube & Vimeo provider throw provider destroyed error #1459

Benny739 opened this issue Oct 6, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Benny739
Copy link

Benny739 commented Oct 6, 2024

Current Behavior:

When youtube or vimeo provider are getting destroyed they are throwing a "provider destroyed" error.
Problem is already mentioned in a discussion: #1378

Expected Behavior:

No error is thrown when provider gets destroyed

Steps To Reproduce:

  1. Switch to youtube or vimeo in the demo
  2. Switch to some other provider
  3. Error gets thrown
@Benny739 Benny739 added the bug Something isn't working label Oct 6, 2024
@wplit
Copy link

wplit commented Oct 9, 2024

I get the same if trying to switch the src from Youtube to Vimeo or the other way around.

If I first set the src = '', and then to the Vimeo src after a timeout, there's no error.

@reilnuud
Copy link

reilnuud commented Oct 17, 2024

I was able to avoid this error by exiting my onProviderChange function before processing the undefined provider:

const onProviderChange = provider => {
  // exit if no provider to prevent error
  if (!provider) {
    return;
  }
  if (isVimeoProvider(provider)) {
      // handle vimeo provider
  }
  if (isYouTubeProvider(provider)) {
    // handle youtube provider
  }
};
  
...

<MediaPlayer 
  onProviderChange={onProviderChange}
  {...}
>
  {...}
</MediaPlayer>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants