Skip to content

Commit

Permalink
fix: use supplier to get youtube clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Apehum committed Nov 10, 2024
1 parent ea5c429 commit 65dbefe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class PlasmoAudioPlayerManager : PluginKoinComponent {
plugin.slF4JLogger.info("YouTube clients: {}", youtubeClients)

lavaPlayerManager.registerSourceManager(
YoutubeAudioSourceManager(true, *youtubeClients.map { it.client }.toTypedArray())
YoutubeAudioSourceManager(true, *youtubeClients.map { it.client.get() }.toTypedArray())
.also { source ->
proxyHttpBuilder?.let { source.httpInterfaceManager.configureBuilder(it) }

Expand Down
23 changes: 12 additions & 11 deletions core/src/main/kotlin/su/plo/voice/discs/config/YoutubeClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ import su.plo.voice.lavaplayer.libs.dev.lavalink.youtube.clients.TvHtml5Embedded
import su.plo.voice.lavaplayer.libs.dev.lavalink.youtube.clients.Web
import su.plo.voice.lavaplayer.libs.dev.lavalink.youtube.clients.WebEmbedded
import su.plo.voice.lavaplayer.libs.dev.lavalink.youtube.clients.skeleton.Client
import java.util.function.Supplier

enum class YoutubeClient(
val client: Client
val client: Supplier<Client>
) {
MUSIC(Music()),
WEB(Web()),
WEBEMBEDDED(WebEmbedded()),
ANDROID(Android()),
ANDROID_VR(AndroidVr()),
ANDROID_TESTSUITE(AndroidTestsuite()),
ANDROID_MUSIC(AndroidMusic()),
MEDIA_CONNECT(MediaConnect()),
IOS(Ios()),
TVHTML5EMBEDDED(TvHtml5Embedded())
MUSIC({ Music() }),
WEB({ Web() }),
WEBEMBEDDED({ WebEmbedded() }),
ANDROID({ Android() }),
ANDROID_VR({ AndroidVr() }),
ANDROID_TESTSUITE({ AndroidTestsuite() }),
ANDROID_MUSIC({ AndroidMusic() }),
MEDIA_CONNECT({ MediaConnect() }),
IOS({ Ios() }),
TVHTML5EMBEDDED({ TvHtml5Embedded() })
}

0 comments on commit 65dbefe

Please sign in to comment.