vue-twitch-player
vue-twitch-player copied to clipboard
Multiple TwitchVideos Element
Hi there,
first of all thank you for the great work and providing this as OS.
I try to include multiple TwitchVideos on one page but only one starts to load. All other components are there but twitch doesn't seem to populate it with the iframe.
Any ideas?
Best regards!
My instinct is a sort of race condition. Basically, the component has to remotely load Twitch's player.js using vue-plugin-load-script. This plugin injects a <script>, and prevents future injections by detecting if a <script> exists with the same source, and resolves the promise if it does -- even if the existing <script> isn't loaded yet. So, the subsequent callers (other TwitchPlayer components) will the script is loaded when it isn't, so the call to Twitch.Player(...) fails.
It will probably require a fix in vue-plugin-load-script to detect unloaded existing <script> tags and to wait on resolving/rejecting until that one's ready.