From 46cd759a5e2b827e4066363ea536984f4ecd33d3 Mon Sep 17 00:00:00 2001 From: denizk0461 Date: Sat, 18 Apr 2026 22:44:50 +0200 Subject: [PATCH] added music player component --- src/lib/media/player.svelte | 229 +++++++++++++++++++++ src/routes/blog/+page.svelte | 1 - src/routes/projects/music/anewbeginning.md | 28 ++- 3 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 src/lib/media/player.svelte diff --git a/src/lib/media/player.svelte b/src/lib/media/player.svelte new file mode 100644 index 0000000..a0ac3d0 --- /dev/null +++ b/src/lib/media/player.svelte @@ -0,0 +1,229 @@ + + +
+
+ + + + +
+

now playing:

+

{tracks[selectedTrackId].title}

+
+ +

+ {format(time)} // {duration ? format(duration) : '--:--'} +

+
+ +
+
{ + const div = e.currentTarget as Element; + + function seek(e: MouseEvent) { + const { left, width } = div.getBoundingClientRect(); + + let p = (e.clientX - left) / width; + if (p < 0) p = 0; + if (p > 1) p = 1; + + time = p * duration; + } + + seek(e); + + window.addEventListener('pointermove', seek); + + window.addEventListener('pointerup', () => { + window.removeEventListener('pointermove', seek); + }, { + once: true + }); + }} + > +
+
+
+ +
+ {#each tracks as t, index} +
+ + +

{t.title}

+ +
+ + + + + + +
+ {/each} +
+
+ + \ No newline at end of file diff --git a/src/routes/blog/+page.svelte b/src/routes/blog/+page.svelte index 59d8f58..8c87168 100644 --- a/src/routes/blog/+page.svelte +++ b/src/routes/blog/+page.svelte @@ -8,7 +8,6 @@ function setFilter(tag: BlogPostTag) { filter = tag; - console.log(filter); } function filterPosts(): BlogPostLink[] { diff --git a/src/routes/projects/music/anewbeginning.md b/src/routes/projects/music/anewbeginning.md index 2ce1504..dc675f2 100644 --- a/src/routes/projects/music/anewbeginning.md +++ b/src/routes/projects/music/anewbeginning.md @@ -1,5 +1,31 @@ + + **A New Beginning** is an EP I wrote back in 2018 in an effort to change up my production style. Originally, this EP was released as *A New Beginning (3-Track)*, featuring A New Beginning as *Nowy Początek* and *Farewell* in two different versions, one being an instrumental titled *Trzymajcie Się*, and the other one being a bootleg of Kelly Clarkson's *Behind These Hazel Eyes* called *Behind These Hazel Eyes (D4rkn355 'Farewell' Bootleg)*! For copyright reasons, the bootleg never made it onto streaming services. This EP, to me, represents the start of a deviation in tone, production quality, and musical style from my previous works. While it was only a start, I am quite proud of the works I produced. -The EP is available for download on [my copyparty instance](https://files.natconf.dev/public/my_tracks/A%20New%20Beginning/). \ No newline at end of file +The EP is available for download on [my copyparty instance](https://files.natconf.dev/public/my_tracks/A%20New%20Beginning/). + + \ No newline at end of file