Skip to content

Commit 1a03dcf

Browse files
author
Kevin Souza
committed
fix switching players
1 parent cb40c35 commit 1a03dcf

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/lib/components/players/YouTube.svelte

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
let audioMuted = false;
1313
1414
onMount(async () => {
15-
if (!player.videoFormats || player.videoFormats.length === 0) return;
16-
usingEmbed = false;
17-
1815
if (playerEl) {
1916
const playerSettings = localStorage.getItem('player-settings');
2017
if (playerSettings) {
@@ -78,7 +75,7 @@
7875
});
7976
</script>
8077

81-
{#if usingEmbed || player.videoFormats.length === 0}
78+
{#if usingEmbed}
8279
<media-player
8380
storage="player-settings"
8481
src={`https://youtu.be/${player.id}`}
@@ -88,7 +85,7 @@
8885
>
8986
<media-provider></media-provider>
9087

91-
<media-plyr-layout></media-plyr-layout>
88+
<media-plyr-layout displayDuration={true}></media-plyr-layout>
9289
</media-player>
9390
{:else}
9491
<media-player

src/routes/videos/watch/+page.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@
5353
5454
onMount(async () => {
5555
const routeURL = new URL(window.location.href);
56-
const searchParams = routeURL.searchParams.get('id')!;
56+
const searchParams = routeURL.searchParams.get('id');
57+
58+
if (!searchParams) {
59+
notify('No video ID found');
60+
return;
61+
}
62+
5763
let videoID = searchParams;
5864
if (searchParams.startsWith('watch?v=')) {
5965
videoID = searchParams.replace('watch?v=', '');

0 commit comments

Comments
 (0)