Skip to content

Commit

Permalink
feat: add audioplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprobst committed Jun 4, 2024
1 parent 32a8c09 commit 988c2d3
Show file tree
Hide file tree
Showing 8 changed files with 346 additions and 6 deletions.
144 changes: 144 additions & 0 deletions content/pages/audio/symphonien.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,147 @@ image: /assets/content/pages/audio/symphonien/image.jpg
Das [**Bruckner Orchester Linz**](https://www.bruckner-orchester.at/de/) und das [**Radio-Symphonieorchester Wien**](https://rso.orf.at/) spielten aus Anlass des 200. Geburtstags **Anton Bruckners** unter der Gesamtleitung von [**Markus Poschner**](https://markusposchner.de/) alle elf Symphonien in allen (18) Fassungen ein. Für diese herausragende Leistung erhielten die beiden Orchester und der Dirigent den renommierten *Special achievement award* des *International Classical Music Awards* *2024*. Die Gesamtedition erscheint beim Label [**Capriccio**](http://capriccio.at/bruckner-complete-versions-edition) (Wien).

Mit Erlaubnis des Labels stellen wir nachfolgend für alle Sätze der Symphonien Audio-Teaser und (falls vorhanden) “Making-of-Videos” zur Verfügung. Zusätzlich werden Links auf die ensprechenden Artikel des *Werkverzeichnis Anton Bruckner* (WAB) und des *Anton Bruckner Lexikon Online* (ABLO) angeboten. Mit einem Klick auf das Vorschaubild des CD-Covers gelangt man zur jeweiligen Beschreibung auf den Websites von Capriccio. Weitergehende Informationen (ABLO): [Symphonien](http://www.bruckner-online.at/ABLO_d1e6664)[Fassungen](http://www.bruckner-online.at/ABLO_d1e5198)

---

## Einführung: Interview mit Paul Hawkshaw

<Video provider="youtube" id="1XR7-8FVUHw" />

---

## Symphonie Nr. 1 in c-Moll (1876, “Linz”) – WAB 101,1

**Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-101)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9829)

<AudioPlayer tracks={[{"title":"Allegro","file":"/assets/content/pages/audio/symphonien/Bruckner_WAB1011-1.mp3"},{"title":"Adagio","file":"/assets/content/pages/audio/symphonien/Bruckner_WAB1011-2.mp3"},{"title":"Scherzo. Schnell. Trio. Langsamer","file":"/assets/content/pages/audio/symphonien/Bruckner_WAB1011-3.mp3"},{"title":"Finale. Bewegt, feurig","file":"/assets/content/pages/audio/symphonien/Bruckner_WAB1011-4.mp3"}]} />

<Video provider="youtube" id="KTkeL6eTdME" />

---

## Symphonie Nr. 1 in c-Moll (1891) – WAB 101,2

**Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-101)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9829)

---

## Symphonie Nr. 2 in c-Moll (1872) – WAB 102,1

**ORF Radio-Symphonieorchester Wien**[Werkverzeichnis](http://www.bruckner-online.at/wab-102)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9846)

<Video provider="youtube" id="E5yse9Ve8N4" />

---

## Symphonie Nr. 2 in c-Moll (1877) – WAB 102,2

<Video provider="youtube" id="ChsLzmuq6P0" />

---

## Symphonie Nr. 3 in d-Moll (1873) – WAB 103,1

<Video provider="youtube" id="QTsiIuyaf8g" />

---

## Symphonie Nr. 3 in d-Moll (1877) und Adagio (1876) – WAB 103,2

**ORF Radio-Symphonieorchester Wien und Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-103)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9862)[Lexikon (Adagio)](http://www.bruckner-online.at/ABLO_d1e8547)

\[erscheint im Juni]

<Video provider="youtube" id="brxQu0LsXE0" />

---

## Symphonie Nr. 3 in d-Moll (1889) – WAB 103,3

**Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-103)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9862)

---

## Symphonie Nr. 4 in Es-Dur (1876, “Romantische”) – WAB 104,1 (Revision)

**ORF Radio-Symphonieorchester Wien**[Werkverzeichnis](http://www.bruckner-online.at/wab-104)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9878)

<Video provider="youtube" id="rq9GFasC334" />

---

## Symphonie Nr. 4 in Es-Dur (1878-80, “Romantische”) – WAB 104,2

**ORF Radio-Symphonieorchester Wien und Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-104)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9878)

---

## Symphonie Nr. 4 in Es-Dur (1888, “Romantische”) – WAB 104,3

**ORF Radio-Symphonieorchester Wien**[Werkverzeichnis](http://www.bruckner-online.at/wab-104)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9878)

---

## Symphonie Nr. 5 in B-Dur – WAB 105

**ORF Radio-Symphonieorchester Wien**[Werkverzeichnis](http://www.bruckner-online.at/wab-105)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9894)

<Video provider="youtube" id="EQAPFy-C3k8" />

---

## Symphonie Nr. 6 in A-Dur – WAB 106

**Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-106)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9910)

<Video provider="youtube" id="mJozPrj8Xag" />

---

## Symphonie Nr. 7 in E-Dur – WAB 107

**ORF Radio-Symphonieorchester Wien**[Werkverzeichnis](http://www.bruckner-online.at/wab-107)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9927)

<Video provider="youtube" id="p_TNrkz1Jos" />

---

## Symphonie Nr. 8 in c-Moll (1887) – WAB 108,1

**Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-108)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9943)

<Video provider="youtube" id="vrg8UdMslU0" />

---

## Symphonie Nr. 8 in c-Moll (1890) – WAB 108,2

**Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-108)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9943)

---

## Symphonie Nr. 9 in d-Moll – WAB 109

**Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-109)[Lexikon](http://www.bruckner-online.at/ABLO_e15d51145)[Lexikon (Skizze in H‑Dur)](http://www.bruckner-online.at/ABLO_d1e9740)

\[erscheint im Juli 2024]

<Video provider="youtube" id="Om2DgEd3eRA" />

---

## Symphonie in d-Moll (“Annulierte”, “Nullte”) – WAB 100

**Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-100)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9821)

<Video provider="youtube" id="2vJLb9kTVbk" />

---

## Symphonie in f-Moll (“Studiensymphonie”) – WAB 99

**Bruckner Orchester Linz**[Werkverzeichnis](http://www.bruckner-online.at/wab-099)[Lexikon](http://www.bruckner-online.at/ABLO_d1e9813)

\[erscheint im Juli 2024]

<Video provider="youtube" id="rrNNo-tV38I" />
60 changes: 54 additions & 6 deletions keystatic.config.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createUrl, pick } from "@acdh-oeaw/lib";
import { collection, config, fields, singleton } from "@keystatic/core";
import { collection, config, fields, NotEditable, singleton } from "@keystatic/core";
import { block, mark, wrapper } from "@keystatic/core/content-components";
import { DownloadIcon, ImageIcon, PencilIcon, ScanIcon, VideoIcon } from "lucide-react";
import { DownloadIcon, ImageIcon, PencilIcon, PlayIcon, ScanIcon, VideoIcon } from "lucide-react";

import { Logo } from "@/components/logo";
import { createAssetPaths, createPreviewUrl } from "@/config/content.config";
Expand All @@ -12,6 +12,52 @@ function createComponents(
components?: Array<"Download" | "Figure" | "Video">,
) {
const allComponents = {
AudioPlayer: block({
label: "AudioPlayer",
description: "An audio player with playlist.",
icon: <PlayIcon />,
schema: {
tracks: fields.array(
fields.object(
{
title: fields.text({
label: "Title",
validation: { isRequired: true },
}),
file: fields.file({
label: "File",
...createAssetPaths(assetPath),
validation: { isRequired: true },
}),
},
{
label: "Track",
},
),
{
label: "Tracks",
itemLabel(props) {
return props.fields.title.value;
},
},
),
},
ContentView(props) {
return (
<NotEditable>
<ul>
{props.value.tracks.map((track, index) => {
return (
<li key={index}>
<div>{track.title}</div>
</li>
);
})}
</ul>
</NotEditable>
);
},
}),
Download: mark({
label: "Download",
// description: "A link to an uploaded file.",
Expand Down Expand Up @@ -99,10 +145,12 @@ function createComponents(
);

return (
<figure>
<iframe allowFullScreen={true} src={href} title="Video" />
{caption ? <figcaption>{caption}</figcaption> : null}
</figure>
<NotEditable>
<figure>
<iframe allowFullScreen={true} src={href} title="Video" />
{caption ? <figcaption>{caption}</figcaption> : null}
</figure>
</NotEditable>
);
},
}),
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
146 changes: 146 additions & 0 deletions src/components/content/audio-player.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
import { Icon } from "astro-icon/components";
interface Props {
tracks: Array<{ title: string; file: string }>;
}
const { tracks } = Astro.props;
---

<audio-player class="not-prose group grid gap-y-2" data-state="pause">
<ul class="grid gap-y-1" role="list">
{
tracks.map((track) => {
return (
<li class="grid">
<audio-track
class="select-none rounded-md border px-4 py-1 transition hover:bg-neutral-100 data-[current]:bg-neutral-100"
data-title={track.title}
data-href={track.file}
tabIndex={0}
>
{track.title}
</audio-track>
</li>
);
})
}
</ul>
<div class="flex items-center gap-x-4">
<button data-control>
<Icon
aria-label="play"
class="size-8 shrink-0 group-data-[state=play]:hidden"
name="lucide:circle-play"
/>
<Icon
aria-label="pause"
class="size-8 shrink-0 group-data-[state=pause]:hidden"
name="lucide:circle-pause"
/>
</button>
<div data-track-title></div>
</div>
</audio-player>

<script>
import { assert } from "@acdh-oeaw/lib";

class AudioPlayer extends HTMLElement {
audio: HTMLAudioElement | null;
button: HTMLButtonElement | null;
currentTrack: number;
track: HTMLDivElement | null;
tracks: Array<{ title: string; href: string; element: HTMLElement }>;

constructor() {
super();

this.audio = null;
this.button = null;
this.currentTrack = 0;
this.track = null;
this.tracks = [];
}

connectedCallback() {
this.audio = document.createElement("audio");

this.audio.addEventListener("pause", () => {
assert(this.audio);
assert(this.track);

this.dataset.state = "pause";
this.track.textContent = "";
});

this.audio.addEventListener("play", () => {
assert(this.audio);
assert(this.track);

const track = this.tracks[this.currentTrack];
assert(track);
this.dataset.state = "play";
this.track.textContent = "Sie hören: " + track.title;
this.tracks.forEach(({ element }) => {
if (element === track.element) {
element.dataset.current = "";
} else {
delete element.dataset.current;
}
});
});

this.audio.addEventListener("ended", () => {
if (this.currentTrack < this.tracks.length - 1) {
this.currentTrack++;
this.play();
}
});

const tracks = this.querySelectorAll<HTMLElement>("audio-track");

tracks.forEach((element, index) => {
element.addEventListener("click", () => {
this.currentTrack = index;
this.play();
});
});

this.tracks = Array.from(tracks).map((element) => {
const { href, title } = element.dataset;
assert(href);
assert(title);
return { href, title, element };
});

this.button = this.querySelector<HTMLButtonElement>("button");

this.button?.addEventListener("click", () => {
assert(this.audio);
if (this.audio.paused) {
this.play();
} else {
this.pause();
}
});

this.track = this.querySelector<HTMLDivElement>("div[data-track-title]");
}

play() {
assert(this.audio);
const track = this.tracks[this.currentTrack];
assert(track);
this.audio.src = track.href;
this.audio.play();
}

pause() {
this.audio?.pause();
}
}

customElements.define("audio-player", AudioPlayer);
</script>
2 changes: 2 additions & 0 deletions src/lib/content/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import type { MDXComponents } from "mdx/types";

import AudioPlayer from "@/components/content/audio-player.astro";
import Download from "@/components/content/download.astro";
import Embed from "@/components/content/embed.astro";
import Figure from "@/components/content/figure.astro";
Expand All @@ -11,6 +12,7 @@ import Video from "@/components/content/video.astro";

export function useMDXComponents(): MDXComponents {
return {
AudioPlayer,
Download,
Embed,
Figure,
Expand Down

0 comments on commit 988c2d3

Please sign in to comment.