mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Adds the audio player transport UI and its three state progress bar.
This commit is contained in:
1 parent
a8e85d0673
commit
0c6de6b392
20 files changed
+1433
-67
No files matched your search
@@ -237,6 +237,7 @@ The bar is fixed to the bottom of the viewport, so the theme owns the room reser
|
||||
| --- | --- | --- |
|
||||
| The bar container, with the `audio-player-container` class | `not-shown` class | The bar is hidden, and its height collapses. |
|
||||
| The bar container | `full-height` class | The bar is expanded to its full height form. |
|
||||
| The bar container | `inert` attribute | Set while the bar is hidden and removed when it is shown, so a collapsed bar keeps none of its focusable controls in the tab order. |
|
||||
| The main content element | `audio-player-not-shown` class | The bar is hidden, so the content area uses the full height. |
|
||||
| The main content element | `audio-player-full-height` class | The bar is expanded, so the content area gives it the full height. |
|
||||
| The full height control | `id="audio-player-full-height-toggle"` | A focusable control, such as a `button`, that expands or collapses the bar. |
|
||||
@@ -250,7 +251,7 @@ The `shared/audio-player` template receives the following model:
|
||||
| `assetBase` | The base URL of the theme assets, used by the theme template to reference its own assets. |
|
||||
| `queueItemTemplate` | The raw source of the `shared/audio-player/queue-item` sub template, inlined by the application into a plain text script element. |
|
||||
| `playlistItemTemplate` | The raw source of the `shared/audio-player/playlist-item` sub template, inlined by the application into a plain text script element. |
|
||||
| `strings` | The localized strings of the bar, keyed by their resource names. |
|
||||
| `strings` | The localized strings of the bar, keyed by their resource names. A shell template uses `toggleFullHeight` and `toggleVisibility` for its two controls; the player reads the play, pause, mute, unmute, volume, seek and buffering labels from the global scripts configuration instead, so a themed shell does not need to render them. |
|
||||
|
||||
A theme must reserve the space for the bar itself, as the bundled themes do:
|
||||
|
||||
@@ -271,7 +272,25 @@ main.audio-player-full-height {
|
||||
|
||||
The application fallback layout, which renders when the active theme cannot be loaded, reserves the room itself, because the application stylesheet does not position the content area of a theme. A theme that omits the rules above leaves the fixed bar overlapping the bottom of the page.
|
||||
|
||||
The markup inside the bar exposes the ten hook attributes the audio player script binds: `data-audio-player-play-pause`, `data-audio-player-progress`, `data-audio-player-progress-played`, `data-audio-player-progress-downloaded`, `data-audio-player-current-time`, `data-audio-player-total-time`, `data-audio-player-track-name`, `data-audio-player-cover-thumbnail`, `data-audio-player-cover-image` and `data-audio-player-queue`. A theme that replaces the bar markup must keep all of them; the part of the bar whose hook is missing stays inert. The play affordances of the pages use the `data-audio-player-play` trigger attribute.
|
||||
The markup inside the bar exposes the hook attributes the audio player script binds. A theme that replaces the bar markup must keep all of them; the part of the bar whose hook is missing stays inert. The play affordances of the pages use the `data-audio-player-play` trigger attribute.
|
||||
|
||||
| Hook attribute | Meaning |
|
||||
| --- | --- |
|
||||
| `data-audio-player-play-pause` | The play and pause control. The player adds the `is-playing` class to it while a track plays. |
|
||||
| `data-audio-player-progress` | The progress bar, a `role="slider"` element with `tabindex="0"` that the player scrubs and whose ARIA value attributes it writes. It carries `data-audio-player-progress-state` (`idle`, `ready` or `buffering`) and the `is-buffering` class while it loads. |
|
||||
| `data-audio-player-progress-played` | The played layer of the bar. The player publishes its start and width as the custom properties `--audio-player-progress-played-start` and `--audio-player-progress-played-width`. |
|
||||
| `data-audio-player-progress-downloaded` | The downloaded but not played layer. `--audio-player-progress-downloaded-start` and `--audio-player-progress-downloaded-width`. |
|
||||
| `data-audio-player-progress-undownloaded` | The not yet downloaded layer. `--audio-player-progress-undownloaded-start` and `--audio-player-progress-undownloaded-width`. |
|
||||
| `data-audio-player-current-time` | The current position, written as `m:ss`. |
|
||||
| `data-audio-player-total-time` | The duration, written as `m:ss`, or `--:--` while it is unknown. |
|
||||
| `data-audio-player-track-name` | The track name. |
|
||||
| `data-audio-player-cover-thumbnail`, `data-audio-player-cover-image` | The cover art of the condensed bar and of the expanded bar. |
|
||||
| `data-audio-player-volume` | The volume slider, a `role="slider"` element with `tabindex="0"` that the player scrubs and whose ARIA value attributes it writes. The fill is published as `--audio-player-volume-start` and `--audio-player-volume-width`. |
|
||||
| `data-audio-player-volume-level` | The volume fill. It carries no geometry of its own: the stylesheet drives it from the custom properties above. |
|
||||
| `data-audio-player-mute` | The mute toggle. The player toggles the `is-muted` class and the `aria-pressed` state on it. |
|
||||
| `data-audio-player-queue` | The queue list of the expanded bar. |
|
||||
|
||||
Each progress layer also carries `data-audio-player-progress-layer` (`played`, `downloaded` or `undownloaded`) in the markup, so a theme can select a layer by its state as well as by its class. The player writes no inline geometry on any of the bar elements: it publishes the geometry of each state as the custom properties above, which the application stylesheet consumes, so a theme restyles or reorients either bar by consuming the same properties.
|
||||
|
||||
#### The audio player sub templates
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>إيقاف</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>جارٍ التخزين المؤقت</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>كتم الصوت</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>إيقاف مؤقت</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>تشغيل</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>موضع التشغيل</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>إلغاء كتم الصوت</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>مستوى الصوت</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>إلغاء</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>Abbrechen</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>Wird gepuffert</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>Stummschalten</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>Pause</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>Abspielen</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>Wiedergabeposition</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>Stummschaltung aufheben</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>Lautstärke</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Abbrechen</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>Abort</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>Buffering</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>Mute</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>Pause</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>Play</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>Playback position</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>Unmute</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>Volume</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>Anular</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>Cargando</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>Silenciar</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>Pausa</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>Reproducir</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>Posición de reproducción</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>Activar sonido</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>Volumen</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Cancelar</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>Abandonner</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>Mise en mémoire tampon</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>Muet</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>Pause</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>Lecture</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>Position de lecture</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>Activer le son</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>Volume</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Annuler</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>Interrompi</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>Caricamento in corso</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>Disattiva audio</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>Pausa</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>Riproduci</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>Posizione di riproduzione</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>Riattiva audio</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>Volume</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Annulla</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>中止する</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>バッファリング中</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>ミュート</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>一時停止</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>再生</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>再生位置</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>ミュート解除</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>音量</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>キャンセル</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>Abort</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>Buffering</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>Mute</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>Pause</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>Play</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>Playback position</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>Unmute</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>Volume</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>Anulare</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>Se încarcă</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>Fără sunet</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>Pauză</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>Redare</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>Poziția de redare</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>Activează sunetul</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>Volum</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Anulare</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>Перервати</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>Буферизація</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>Вимкнути звук</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>Пауза</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>Відтворити</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>Позиція відтворення</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>Увімкнути звук</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>Гучність</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Скасувати</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,27 @@
|
||||
<data name="Abort" xml:space="preserve">
|
||||
<value>中止</value>
|
||||
</data>
|
||||
<data name="AudioPlayerBuffering" xml:space="preserve">
|
||||
<value>缓冲中</value>
|
||||
</data>
|
||||
<data name="AudioPlayerMute" xml:space="preserve">
|
||||
<value>静音</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPause" xml:space="preserve">
|
||||
<value>暂停</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPlay" xml:space="preserve">
|
||||
<value>播放</value>
|
||||
</data>
|
||||
<data name="AudioPlayerSeek" xml:space="preserve">
|
||||
<value>播放位置</value>
|
||||
</data>
|
||||
<data name="AudioPlayerUnmute" xml:space="preserve">
|
||||
<value>取消静音</value>
|
||||
</data>
|
||||
<data name="AudioPlayerVolume" xml:space="preserve">
|
||||
<value>音量</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>取消</value>
|
||||
</data>
|
||||
|
||||
@@ -20,13 +20,29 @@
|
||||
|
||||
The DOM contract a theme must preserve is:
|
||||
- The container element with the 'audio-player-container' class, carrying 'not-shown' while the bar is hidden,
|
||||
and 'full-height' while it is expanded. The audio player toggles both classes.
|
||||
and 'full-height' while it is expanded. The audio player toggles both classes. While the bar is hidden the
|
||||
player also sets the 'inert' attribute on it, and removes it when the bar is shown, so a collapsed bar keeps
|
||||
none of its focusable controls in the tab order.
|
||||
- The main content element, carrying 'audio-player-not-shown' while the bar is hidden, and 'audio-player-full-height'
|
||||
while it is expanded. The audio player toggles both classes on it as well.
|
||||
- The elements with the ids 'audio-player-full-height-toggle' and 'audio-player-close', which the global site script
|
||||
binds and routes to the audio player.
|
||||
- The hook attributes the audio player binds: 'data-audio-player-play-pause', '-progress', '-progress-played',
|
||||
'-progress-downloaded', '-current-time', '-total-time', '-track-name', '-cover-thumbnail', '-cover-image' and '-queue'.
|
||||
'-progress-downloaded', '-progress-undownloaded', '-current-time', '-total-time', '-track-name',
|
||||
'-cover-thumbnail', '-cover-image', '-volume', '-volume-level', '-mute' and '-queue'. The volume fill element
|
||||
('-volume-level') is a styling hook the stylesheet drives from the custom properties below, not one the script
|
||||
writes to.
|
||||
- The three state progress bar: the played part carries 'audio-player-progress-played', the downloaded but not
|
||||
played part carries 'audio-player-progress-downloaded', and the not yet downloaded part carries
|
||||
'audio-player-progress-undownloaded'. Each layer also carries 'data-audio-player-progress-layer' ('played',
|
||||
'downloaded' or 'undownloaded') in the markup, so a theme can select a layer by state as well as by class. The
|
||||
player publishes the start and the width of each state as the CSS custom properties
|
||||
'--audio-player-progress-played-start', '-played-width', '-downloaded-start', '-downloaded-width',
|
||||
'-undownloaded-start' and '-undownloaded-width' on the bar, and the volume fill as
|
||||
'--audio-player-volume-start' and '--audio-player-volume-width' on the volume control, and writes no inline
|
||||
geometry, so a theme consumes the properties to style each state and to give either bar its own shape and
|
||||
orientation. The player marks the bar with 'is-buffering' while it is loading, and carries the state in
|
||||
'data-audio-player-progress-state' ('idle', 'ready' or 'buffering') together with the slider ARIA attributes.
|
||||
- The plain text script elements that carry the raw source of the 'shared/audio-player/queue-item' and
|
||||
'shared/audio-player/playlist-item' sub templates, with the ids 'audio-player-template-queue-item' and
|
||||
'audio-player-template-playlist-item'.
|
||||
@@ -41,21 +57,32 @@
|
||||
<img class="audio-player-cover-image" data-audio-player-cover-image alt="" />
|
||||
<ul class="audio-player-queue" data-audio-player-queue></ul>
|
||||
</div>
|
||||
<!-- Condensed bar: transport control, progress bar and track name. -->
|
||||
<!-- Condensed bar: transport controls, three state progress bar, volume, and track name. -->
|
||||
<div class="audio-player-bar">
|
||||
<img class="audio-player-cover-thumbnail" data-audio-player-cover-thumbnail alt="" />
|
||||
<span class="audio-player-track-name" data-audio-player-track-name></span>
|
||||
<span class="audio-player-time audio-player-current-time" data-audio-player-current-time>0:00</span>
|
||||
<div class="audio-player-progress" data-audio-player-progress>
|
||||
<div class="audio-player-progress-downloaded" data-audio-player-progress-downloaded></div>
|
||||
<div class="audio-player-progress-played" data-audio-player-progress-played></div>
|
||||
<div class="audio-player-progress" data-audio-player-progress data-audio-player-progress-state="idle" role="slider" tabindex="0"
|
||||
aria-label="@localizer["AudioPlayerSeek"]" aria-valuemin="0" aria-valuemax="1" aria-valuenow="0" aria-busy="false">
|
||||
<div class="audio-player-progress-undownloaded" data-audio-player-progress-undownloaded data-audio-player-progress-layer="undownloaded"></div>
|
||||
<div class="audio-player-progress-downloaded" data-audio-player-progress-downloaded data-audio-player-progress-layer="downloaded"></div>
|
||||
<div class="audio-player-progress-played" data-audio-player-progress-played data-audio-player-progress-layer="played"></div>
|
||||
</div>
|
||||
<span class="audio-player-time audio-player-total-time" data-audio-player-total-time>--:--</span>
|
||||
<div class="audio-player-transport">
|
||||
<button type="button" class="audio-player-button audio-player-play-pause" data-audio-player-play-pause>
|
||||
<button type="button" class="audio-player-button audio-player-play-pause" data-audio-player-play-pause aria-label="@localizer["AudioPlayerPlay"]">
|
||||
<span class="audio-player-play-pause-icon"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="audio-player-volume-control">
|
||||
<button type="button" class="audio-player-button audio-player-mute" data-audio-player-mute aria-label="@localizer["AudioPlayerMute"]" aria-pressed="false">
|
||||
<span class="audio-player-mute-icon"></span>
|
||||
</button>
|
||||
<div class="audio-player-volume" data-audio-player-volume role="slider" tabindex="0"
|
||||
aria-label="@localizer["AudioPlayerVolume"]" aria-valuemin="0" aria-valuemax="100" aria-valuenow="100">
|
||||
<div class="audio-player-volume-level" data-audio-player-volume-level></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="audio-player-controls">
|
||||
<button type="button" id="audio-player-full-height-toggle">@localizer["ToggleFullHeight"]</button>
|
||||
<button type="button" id="audio-player-close">@localizer["ToggleVisibility"]</button>
|
||||
|
||||
@@ -33,13 +33,31 @@
|
||||
error: '@localizer["Error"]',
|
||||
information: '@localizer["Information"]'
|
||||
};
|
||||
// The endpoints the audio player reads the stored playback preferences of the user from. The routes are the culture
|
||||
// aware web routes, so the player never hardcodes a path, and it never reaches the API server directly.
|
||||
// The endpoints the audio player reads the stored playback preferences of the user from, and writes the volume and
|
||||
// mute state it changes back to. The routes are the culture aware web routes, so the player never hardcodes a path,
|
||||
// and it never reaches the API server directly.
|
||||
var audioPlayerConfiguration = {
|
||||
getUserSettingsUrl: '@_urlService.GetAbsoluteUrl(WebRoutes.Settings.GET_USER_SETTINGS)',
|
||||
getPlaybackStateUrl: '@_urlService.GetAbsoluteUrl(WebRoutes.Settings.GET_PLAYBACK_STATE)'
|
||||
getPlaybackStateUrl: '@_urlService.GetAbsoluteUrl(WebRoutes.Settings.GET_PLAYBACK_STATE)',
|
||||
updatePlaybackStateUrl: '@_urlService.GetAbsoluteUrl(WebRoutes.Settings.UPDATE_PLAYBACK_STATE)',
|
||||
strings: {
|
||||
play: '@localizer["AudioPlayerPlay"]',
|
||||
pause: '@localizer["AudioPlayerPause"]',
|
||||
mute: '@localizer["AudioPlayerMute"]',
|
||||
unmute: '@localizer["AudioPlayerUnmute"]',
|
||||
volume: '@localizer["AudioPlayerVolume"]',
|
||||
seek: '@localizer["AudioPlayerSeek"]',
|
||||
buffering: '@localizer["AudioPlayerBuffering"]'
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@if (User?.Identity?.IsAuthenticated == true)
|
||||
{
|
||||
<!-- The audio player writes the volume and mute state it changes to the playback state endpoint, which validates an
|
||||
anti-forgery token. The player is rendered only for an authenticated visitor, so the token is rendered here too,
|
||||
once, with the global configuration, whatever the active theme is. -->
|
||||
@Html.AntiForgeryToken()
|
||||
}
|
||||
<script src="~/libs/microsoft-signalr/signalr.min.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/notifications.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/dialogs.js" asp-append-version="true"></script>
|
||||
|
||||
@@ -1340,27 +1340,76 @@ html.audio-player-initializing .audio-player-container {
|
||||
flex: 2 1 40%;
|
||||
min-width: 40px;
|
||||
height: 6px;
|
||||
background-color: #333333;
|
||||
background-color: transparent;
|
||||
cursor: pointer;
|
||||
/* A touch drag is claimed by the control instead of the browser, which would otherwise cancel the gesture. */
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
/* The bar exposes three distinct states a theme can style: the not yet downloaded track, the downloaded
|
||||
part ('audio-player-progress-downloaded'), and the played part ('audio-player-progress-played'). */
|
||||
/* The bar exposes three distinct states a theme can style independently: the not yet downloaded track
|
||||
('audio-player-progress-undownloaded'), the downloaded but not played part ('audio-player-progress-downloaded'),
|
||||
and the played part ('audio-player-progress-played'). The player publishes the start and the width of each state as
|
||||
the custom properties below, and this stylesheet consumes them; a theme overrides these rules, or consumes the same
|
||||
properties itself, to give each state its own look and the bar its own shape or orientation. */
|
||||
.audio-player-progress-played,
|
||||
.audio-player-progress-downloaded {
|
||||
.audio-player-progress-downloaded,
|
||||
.audio-player-progress-undownloaded {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.audio-player-progress-played {
|
||||
left: var(--audio-player-progress-played-start, 0%);
|
||||
width: var(--audio-player-progress-played-width, 0%);
|
||||
background-color: #6DCBFE;
|
||||
}
|
||||
|
||||
.audio-player-progress-downloaded {
|
||||
left: var(--audio-player-progress-downloaded-start, 0%);
|
||||
width: var(--audio-player-progress-downloaded-width, 0%);
|
||||
background-color: #5A6B78;
|
||||
}
|
||||
|
||||
.audio-player-progress-played {
|
||||
background-color: #6DCBFE;
|
||||
.audio-player-progress-undownloaded {
|
||||
left: var(--audio-player-progress-undownloaded-start, 0%);
|
||||
width: var(--audio-player-progress-undownloaded-width, 100%);
|
||||
background-color: #333333;
|
||||
}
|
||||
|
||||
/* While a seek waits for the range of its target position the bar pulses, so the loading state is visible without a
|
||||
separate element. A theme restyles it through the 'is-buffering' class. The pulse is a decoration, so it is dropped
|
||||
when the visitor asked for reduced motion; the 'is-buffering' class and the state attribute still mark the state. */
|
||||
.audio-player-progress.is-buffering {
|
||||
animation: audio-player-progress-buffering 1s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes audio-player-progress-buffering {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
50% {
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.audio-player-progress.is-buffering {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
.audio-player-progress.is-scrubbing {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.audio-player-volume.is-scrubbing {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.audio-player-transport {
|
||||
@@ -1400,6 +1449,64 @@ html.audio-player-initializing .audio-player-container {
|
||||
border-left: 3px solid #E6E6E6;
|
||||
}
|
||||
|
||||
.audio-player-volume-control {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.audio-player-mute {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 0px;
|
||||
background-color: transparent;
|
||||
border: 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* The speaker cone of the mute toggle is drawn with CSS, so that a theme restyles it without an image. */
|
||||
.audio-player-mute-icon {
|
||||
display: block;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
border-style: solid;
|
||||
border-width: 5px 8px 5px 0px;
|
||||
border-color: transparent #E6E6E6 transparent transparent;
|
||||
}
|
||||
|
||||
.audio-player-mute.is-muted .audio-player-mute-icon {
|
||||
border-right-color: #8A8A8A;
|
||||
}
|
||||
|
||||
/* The volume fill is positioned from the custom properties the player publishes, exactly like the progress bar, so a
|
||||
theme restyles or reorients it without any inline geometry. touch-action is disabled on both sliders so a touch drag
|
||||
is claimed by the control instead of the browser, which would otherwise cancel the gesture mid-drag. */
|
||||
.audio-player-volume {
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 6px;
|
||||
background-color: #333333;
|
||||
cursor: pointer;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.audio-player-volume-level {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: var(--audio-player-volume-start, 0%);
|
||||
width: var(--audio-player-volume-width, 100%);
|
||||
height: 100%;
|
||||
background-color: #6DCBFE;
|
||||
}
|
||||
|
||||
.audio-player-volume.is-muted .audio-player-volume-level {
|
||||
background-color: #5A6B78;
|
||||
}
|
||||
|
||||
.audio-player-controls {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
|
||||
@@ -13,8 +13,12 @@
|
||||
* - loadAsync(descriptor): prepares the resources of a track (opens its stream, configures a decoder).
|
||||
* - playAsync(): starts, or resumes, audible playback.
|
||||
* - pauseAsync(): suspends audible playback, keeping the current position.
|
||||
* - seekAsync(seconds): moves the playhead to the given position, in seconds.
|
||||
* - seekAsync(seconds): moves the playhead to the given position, in seconds, fetching the range of that position
|
||||
* when it has not been downloaded yet.
|
||||
* - setVolumeAsync(volume): sets the output volume, as a value between 0 and 1, with 0 meaning silence.
|
||||
* - getBufferedTimeRanges(): the time ranges, in seconds, the engine already downloaded, as a list of objects with
|
||||
* a 'start' and an 'end'. It is optional: an engine that does not implement it makes the player unable to tell
|
||||
* whether a seek target is buffered, in which case the player never shows a loading state for a seek.
|
||||
* - destroyAsync(): releases every resource the engine holds, including any audio context.
|
||||
*
|
||||
* The engine host
|
||||
@@ -27,6 +31,9 @@
|
||||
* - host.reportTime(currentTime, duration): reports the playhead and the known duration.
|
||||
* - host.reportDuration(duration): reports a duration discovered after loading.
|
||||
* - host.reportProgress(downloadedFraction): reports how much of the track has been downloaded, between 0 and 1.
|
||||
* - host.reportBuffering(isBuffering): reports that the engine is, or is no longer, waiting for data, so that the
|
||||
* bar shows the same loading state for an engine's own range fetch as it does for a seek. The state it sets
|
||||
* stays until the engine reports it is no longer buffering, and a playhead report never clears it.
|
||||
* - host.reportEnded(): reports that the current track reached its end.
|
||||
* - host.reportError(error): reports an engine failure, wrapped into a {@link LuminaAudioPlayer.PlayerError}. A download
|
||||
* engine must forward its downloader's onError here, because the downloader only reports to its own callback and
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
MUTE_CHANGED: 'mutechange',
|
||||
// The downloaded fraction of the current track changed. Payload: { downloadedFraction }.
|
||||
PROGRESS: 'progress',
|
||||
// A seek started waiting for the range of its target position, or such a wait ended. Payload: { isBuffering, pendingSeekTime }.
|
||||
BUFFERING_CHANGED: 'bufferingchange',
|
||||
// The current track reached its end.
|
||||
ENDED: 'ended',
|
||||
// A {@link LuminaAudioPlayer.PlayerError} was raised. Payload: the player error.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user