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

Player unusable after error at instantiation #166

Closed
LoveIsGrief opened this issue Sep 30, 2017 · 3 comments
Closed

Player unusable after error at instantiation #166

LoveIsGrief opened this issue Sep 30, 2017 · 3 comments
Assignees
Labels
bug Something isn't working player

Comments

@LoveIsGrief
Copy link
Contributor

Maybe related to #165

Expected Behavior

The player should be able to call all its methods after instantiating a bad player, but their promises should all be caught.

Actual Behavior

Promises are never fullfilled.

Steps to Reproduce

Codepen

  1. Create a new player with an invalid URL
  2. Try to load a valid video

Possible source

callMethod in player.js. It only tries to do its stuff when the player is ready, but if it never started out ready, then it just won't do anything.

LoveIsGrief added a commit to LoveIsGrief/videojs-externals that referenced this issue Oct 1, 2017
@mirague
Copy link

mirague commented Nov 12, 2017

Also running into this problem, are there any known workarounds until this gets solved?

Edit: I can't even seem to create a new player instance, does it use some sort of global cache?

Edit 2: It seems the faulty players -are- in fact cached, even when it hits this "deadlock" failure state. See my comment below.

@mirague
Copy link

mirague commented Nov 12, 2017

After looking into this I see that the player is cached inside a WeakMap, and returned if it already exists: https://github.com/vimeo/player.js/blob/master/src/player.js#L59

This poses a problem if you're trying to reuse the element inside for example React. Perhaps if the instantiation fails we should undo any created side-effects (in effect removing the cached element from the WeakMap)? Now users wanting to use Vimeo on a mounted React component are forced to use a hacky workaround to unmount the element from the DOM and re-insert it.

@luwes @bdougherty Thoughts?

@luwes
Copy link
Contributor

luwes commented Jan 9, 2019

When loading an invalid clip the ready promise will now reject and in turn all getters, setters and methods as well.

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

No branches or pull requests

4 participants