From e939c6b0bdaa1099b8cd5b69e426cbcf0aa4f0ac Mon Sep 17 00:00:00 2001 From: mrjvs Date: Thu, 19 Oct 2023 16:33:14 +0200 Subject: [PATCH] autoplay if there is only one embed --- .../player/atoms/settings/SourceSelectingView.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/player/atoms/settings/SourceSelectingView.tsx b/src/components/player/atoms/settings/SourceSelectingView.tsx index 4eaffef9..44d4f434 100644 --- a/src/components/player/atoms/settings/SourceSelectingView.tsx +++ b/src/components/player/atoms/settings/SourceSelectingView.tsx @@ -109,6 +109,18 @@ export function EmbedSelectionView({ sourceId, id }: EmbedSelectionViewProps) { router.close(); return null; } + if (result.embeds.length === 1) { + const embedResult = await providers.runEmbedScraper({ + id: result.embeds[0].embedId, + url: result.embeds[0].url, + }); + setSourceId(sourceId); + setSource( + convertRunoutputToSource({ stream: embedResult.stream }), + progress + ); + router.close(); + } return result.embeds; }, [sourceId, meta, router]);