-
Notifications
You must be signed in to change notification settings - Fork 262
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
Introduce Player::destroy #167
Conversation
This allows a player to be removed and a new one created. Asking a destroyed player to execute functions will just fail.
|
Would love to see this functionality. Having a way to properly reset to the initial state, with no saved/cached side-effects, would allow us to create reliable apps with this package. Currently it's way too unstable and errors happen left and right with not much for us to do about (apart from forking it and addressing these issues ourselves). For this PR I suppose we just need to update the |
Also changed the description of unload in order to distinguish from destroy.
As suggested by @mirague , I updated |
Thanks for submitting this @LoveIsGrief. Any idea who to ping to keep this moving? |
I guess @luwes and @bdougherty ? |
Unfortunately they don't seem very active with this repository, which is a shame because it's quite close to being good and usable – it just lacks some stability. |
@LoveIsGrief I think there is some missing cleanup here - if you instantiate a For that particular use case, we end up with two references in the
The current code (before your PR) confusingly first sets This means that there is currently no way to get a reference to the original element and do the necessary cleanup within your new Please see my quick fork in which I have duplicated your PR and added some extra logic to address the above: |
Hi @JamesHenry Sorry for the late response, I didn't see the update :/ Hopefully the maintainers will be able to review the code. |
I will review this soon. Thanks for your patience guys! |
Sometimes we have to cleanup and start from scratch. For that a destroy method can come in handy.
The introduced method will remove any references to the current player and destroy a possibly existing iframe.
This PR is inspired as a workaround to " Player unusable after error at instantiation #166" which makes it impossible to use the player on the same iframe, if the player couldn't be instantiated.