vlitejs / vlite

🦋 vLitejs is a fast and lightweight Javascript library for customizing video and audio player in Javascript with a minimalist theme (HTML5, Youtube, Vimeo, Dailymotion)
https://vlite.js.org
MIT License
266 stars 18 forks source link

Clear providers and plugins on destroy #79

Closed v-stempel closed 1 year ago

v-stempel commented 2 years ago

If the feature request is for a plugin or provider, specify it here.

No response

If the feature solves a problem you have, specify it here.

No response

Describe the proposed feature.

Hi, I propose to clear providers and plugins on player destroy, because on SPA it causes an error that provider/plugin already registered.

Describe alternatives you've considered

As alternative - don't throw the error when prividers/plugins are registered and just ignore registration.

Additional context

No response

Related Issues

No response

yoriiis commented 2 years ago

Hello @v-stempel, after digging I will revert the #83 because it's not within the scope of the destroy function.

The error is throw when the registerPlugin or registerProvider function is called multiple times. Player initialization and plugin/provider registration are two different steps.

In an SPA, the registration must be done only once. I think it's just a problem in the implementation.