mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 01:11:10 +00:00
Implements player queue engine
This commit is contained in:
1 parent
45f9aa3bd5
commit
93821a2776
27 files changed
+4114
-186
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>نعم</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>المقطع السابق</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>المقطع التالي</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>تشغيل عشوائي</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>تشغيل الألبوم عشوائياً</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>تشغيل الفنان عشوائياً</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>تشغيل المكتبة عشوائياً</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>تكرار</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>التكرار متوقف</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>تكرار الكل</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>تكرار مقطع واحد</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>قائمة التشغيل</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>تشغيل عشوائي متوقف</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Ja</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>Vorheriger Titel</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>Nächster Titel</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>Zufallswiedergabe</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>Release zufällig abspielen</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>Interpret zufällig abspielen</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>Bibliothek zufällig abspielen</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>Wiederholen</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>Wiederholung aus</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>Alle wiederholen</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>Titel wiederholen</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>Warteschlange</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>Zufallswiedergabe aus</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Yes</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>Previous track</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>Next track</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>Shuffle</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>Shuffle release</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>Shuffle artist</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>Shuffle library</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>Repeat</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>Repeat off</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>Repeat all</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>Repeat one</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>Play queue</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>Shuffle off</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Sí</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>Pista anterior</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>Pista siguiente</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>Reproducción aleatoria</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>Aleatorio por álbum</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>Aleatorio por artista</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>Aleatorio por biblioteca</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>Repetir</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>Repetición desactivada</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>Repetir todo</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>Repetir pista</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>Cola de reproducción</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>Reproducción aleatoria desactivada</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Oui</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>Piste précédente</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>Piste suivante</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>Lecture aléatoire</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>Aléatoire sur la sortie</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>Aléatoire sur l’artiste</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>Aléatoire sur la bibliothèque</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>Répéter</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>Répétition désactivée</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>Tout répéter</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>Répéter la piste</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>File de lecture</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>Lecture aléatoire désactivée</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Sì</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>Brano precedente</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>Brano successivo</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>Riproduzione casuale</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>Casuale per album</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>Casuale per artista</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>Casuale per libreria</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>Ripeti</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>Ripetizione disattivata</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>Ripeti tutto</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>Ripeti brano</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>Coda di riproduzione</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>Riproduzione casuale disattivata</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>はい</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>前の曲</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>次の曲</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>シャッフル</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>アルバムをシャッフル</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>アーティストをシャッフル</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>ライブラリをシャッフル</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>リピート</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>リピートなし</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>すべてリピート</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>1曲リピート</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>再生キュー</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>シャッフルなし</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Yes</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>Previous track</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>Next track</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>Shuffle</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>Shuffle release</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>Shuffle artist</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>Shuffle library</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>Repeat</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>Repeat off</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>Repeat all</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>Repeat one</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>Play queue</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>Shuffle off</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Da</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>Piesa anterioară</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>Piesa următoare</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>Redare aleatorie</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>Aleatoriu pe album</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>Aleatoriu pe artist</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>Aleatoriu pe bibliotecă</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>Repetă</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>Repetare oprită</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>Repetă tot</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>Repetă piesa</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>Coada de redare</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>Redare aleatorie oprită</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Так</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>Попередній трек</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>Наступний трек</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>Перемішати</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>Перемішати альбом</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>Перемішати виконавця</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>Перемішати бібліотеку</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>Повтор</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>Повтор вимкнено</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>Повторити все</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>Повторити трек</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>Черга відтворення</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>Перемішування вимкнено</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -180,4 +180,40 @@
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>是</value>
|
||||
</data>
|
||||
<data name="AudioPlayerPrevious" xml:space="preserve">
|
||||
<value>上一首</value>
|
||||
</data>
|
||||
<data name="AudioPlayerNext" xml:space="preserve">
|
||||
<value>下一首</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffle" xml:space="preserve">
|
||||
<value>随机播放</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleRelease" xml:space="preserve">
|
||||
<value>随机播放专辑</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleArtist" xml:space="preserve">
|
||||
<value>随机播放艺术家</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleLibrary" xml:space="preserve">
|
||||
<value>随机播放音乐库</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeat" xml:space="preserve">
|
||||
<value>循环播放</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOff" xml:space="preserve">
|
||||
<value>不循环</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatAll" xml:space="preserve">
|
||||
<value>列表循环</value>
|
||||
</data>
|
||||
<data name="AudioPlayerRepeatOne" xml:space="preserve">
|
||||
<value>单曲循环</value>
|
||||
</data>
|
||||
<data name="AudioPlayerQueue" xml:space="preserve">
|
||||
<value>播放队列</value>
|
||||
</data>
|
||||
<data name="AudioPlayerShuffleOff" xml:space="preserve">
|
||||
<value>关闭随机播放</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -42,7 +42,19 @@ public sealed class ThemeAudioPlayerBuilder
|
||||
Dictionary<string, object?> strings = new()
|
||||
{
|
||||
["toggleFullHeight"] = Localize("ToggleFullHeight"),
|
||||
["toggleVisibility"] = Localize("ToggleVisibility")
|
||||
["toggleVisibility"] = Localize("ToggleVisibility"),
|
||||
["previous"] = Localize("AudioPlayerPrevious"),
|
||||
["next"] = Localize("AudioPlayerNext"),
|
||||
["shuffle"] = Localize("AudioPlayerShuffle"),
|
||||
["shuffleOff"] = Localize("AudioPlayerShuffleOff"),
|
||||
["shuffleRelease"] = Localize("AudioPlayerShuffleRelease"),
|
||||
["shuffleArtist"] = Localize("AudioPlayerShuffleArtist"),
|
||||
["shuffleLibrary"] = Localize("AudioPlayerShuffleLibrary"),
|
||||
["repeat"] = Localize("AudioPlayerRepeat"),
|
||||
["repeatOff"] = Localize("AudioPlayerRepeatOff"),
|
||||
["repeatAll"] = Localize("AudioPlayerRepeatAll"),
|
||||
["repeatOne"] = Localize("AudioPlayerRepeatOne"),
|
||||
["queue"] = Localize("AudioPlayerQueue")
|
||||
};
|
||||
|
||||
return new ThemeAudioPlayerDto(
|
||||
|
||||
@@ -27,11 +27,20 @@
|
||||
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', '-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 hook attributes the audio player binds: 'data-audio-player-play-pause', '-previous', '-next', '-shuffle',
|
||||
'-shuffle-control', '-shuffle-menu', '-repeat', '-progress', '-progress-played', '-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 shuffle scope items carry 'data-audio-player-shuffle-scope' ('off', 'release', 'artist' or 'library'), inside
|
||||
the menu element carrying 'data-audio-player-shuffle-menu'. The shuffle control carries 'data-audio-player-shuffle'
|
||||
and is wrapped by 'data-audio-player-shuffle-control', so the player can open the menu near it and close it on an
|
||||
outside click. It is a menu button: it carries 'aria-haspopup' and 'aria-expanded', gets the 'is-active' class while
|
||||
shuffle is on, and does not carry 'aria-pressed'. The scope items get 'aria-checked' and the 'is-selected' class, and
|
||||
the 'off' item is selected while shuffle is off. The repeat toggle carries 'data-audio-player-repeat' and the player
|
||||
writes 'data-audio-player-repeat-mode' ('off', 'all' or 'one') and toggles the 'is-active' and 'is-one' classes on it.
|
||||
A queue item root rendered by the player always carries 'data-audio-player-queue-entry-id', whether it comes from the
|
||||
theme sub template or from the built-in markup, so clicking it starts that entry.
|
||||
- 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',
|
||||
@@ -43,19 +52,22 @@
|
||||
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'.
|
||||
- Themed shells only: 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'. This application fallback partial
|
||||
renders neither element; it intentionally uses the built-in queue item markup.
|
||||
|
||||
The play affordances the pages hand to the player use the 'data-audio-player-play' trigger attribute. The
|
||||
'The Audio Player Bar' section of docs/technical/theming/Theming.md documents this contract for theme authors.
|
||||
The play affordances the pages hand to the player use the 'data-audio-player-play' trigger attribute, and a play next
|
||||
affordance uses 'data-audio-player-play-next'. A track trigger must carry libraryId, trackId, albumId and artistId,
|
||||
because the playback manifest route needs all four Ids. The 'The Audio Player Bar' section of
|
||||
docs/technical/theming/Theming.md documents this contract for theme authors.
|
||||
*@
|
||||
|
||||
<div class="audio-player-container not-shown" hidden>
|
||||
<!-- Expanded area: cover art, and the queue when the play context holds more than one track. -->
|
||||
<div class="audio-player-expanded">
|
||||
<img class="audio-player-cover-image" data-audio-player-cover-image alt="" />
|
||||
<ul class="audio-player-queue" data-audio-player-queue></ul>
|
||||
<ul class="audio-player-queue" data-audio-player-queue aria-label="@localizer["AudioPlayerQueue"]"></ul>
|
||||
</div>
|
||||
<!-- Condensed bar: transport controls, three state progress bar, volume, and track name. -->
|
||||
<div class="audio-player-bar">
|
||||
@@ -69,9 +81,32 @@
|
||||
<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">
|
||||
<div class="audio-player-queue-controls">
|
||||
<div class="audio-player-shuffle-control" data-audio-player-shuffle-control>
|
||||
<button type="button" class="audio-player-button audio-player-shuffle" data-audio-player-shuffle
|
||||
aria-haspopup="menu" aria-expanded="false" aria-label="@localizer["AudioPlayerShuffle"]">
|
||||
<span class="audio-player-shuffle-icon" aria-hidden="true">⇆</span>
|
||||
</button>
|
||||
<div class="audio-player-shuffle-menu" data-audio-player-shuffle-menu role="menu" hidden>
|
||||
<button type="button" role="menuitemradio" aria-checked="true" data-audio-player-shuffle-scope="off">@localizer["AudioPlayerShuffleOff"]</button>
|
||||
<button type="button" role="menuitemradio" aria-checked="false" data-audio-player-shuffle-scope="release">@localizer["AudioPlayerShuffleRelease"]</button>
|
||||
<button type="button" role="menuitemradio" aria-checked="false" data-audio-player-shuffle-scope="artist">@localizer["AudioPlayerShuffleArtist"]</button>
|
||||
<button type="button" role="menuitemradio" aria-checked="false" data-audio-player-shuffle-scope="library">@localizer["AudioPlayerShuffleLibrary"]</button>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="audio-player-button audio-player-previous" data-audio-player-previous aria-label="@localizer["AudioPlayerPrevious"]">
|
||||
<span class="audio-player-previous-icon" aria-hidden="true"></span>
|
||||
</button>
|
||||
<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>
|
||||
<span class="audio-player-play-pause-icon" aria-hidden="true"></span>
|
||||
</button>
|
||||
<button type="button" class="audio-player-button audio-player-next" data-audio-player-next aria-label="@localizer["AudioPlayerNext"]">
|
||||
<span class="audio-player-next-icon" aria-hidden="true"></span>
|
||||
</button>
|
||||
<button type="button" class="audio-player-button audio-player-repeat" data-audio-player-repeat data-audio-player-repeat-mode="off"
|
||||
aria-pressed="false" aria-label="@localizer["AudioPlayerRepeatOff"]">
|
||||
<span class="audio-player-repeat-icon" aria-hidden="true">↻</span>
|
||||
<span class="audio-player-repeat-one-badge" aria-hidden="true">1</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="audio-player-volume-control">
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
getPlaybackManifestUrl: '@_urlService.GetRelativeUrl(WebRoutes.Music.GET_PLAYBACK_MANIFEST)',
|
||||
streamTrackRouteTemplate: '@_urlService.GetRelativeUrl(WebRoutes.Music.STREAM_TRACK)',
|
||||
streamTrackSegmentRouteTemplate: '@_urlService.GetRelativeUrl(WebRoutes.Music.STREAM_TRACK_SEGMENT)',
|
||||
// The endpoints the queue of the player is built from: the releases of an artist, the tracks of a release, and the
|
||||
// artists of a library, which are also the endpoints the autoplay continuation and the library shuffle use. The
|
||||
// queue script documents which context uses which endpoint, and appends the library and pagination query parameters.
|
||||
getArtistsUrl: '@_urlService.GetRelativeUrl(WebRoutes.Music.GET_ARTISTS)',
|
||||
getArtistAlbumsUrl: '@_urlService.GetRelativeUrl(WebRoutes.Music.GET_ARTIST_ALBUMS)',
|
||||
getAlbumTracksUrl: '@_urlService.GetRelativeUrl(WebRoutes.Music.GET_ALBUM_TRACKS)',
|
||||
strings: {
|
||||
play: '@localizer["AudioPlayerPlay"]',
|
||||
pause: '@localizer["AudioPlayerPause"]',
|
||||
@@ -51,7 +57,19 @@
|
||||
unmute: '@localizer["AudioPlayerUnmute"]',
|
||||
volume: '@localizer["AudioPlayerVolume"]',
|
||||
seek: '@localizer["AudioPlayerSeek"]',
|
||||
buffering: '@localizer["AudioPlayerBuffering"]'
|
||||
buffering: '@localizer["AudioPlayerBuffering"]',
|
||||
previous: '@localizer["AudioPlayerPrevious"]',
|
||||
next: '@localizer["AudioPlayerNext"]',
|
||||
shuffle: '@localizer["AudioPlayerShuffle"]',
|
||||
shuffleOff: '@localizer["AudioPlayerShuffleOff"]',
|
||||
shuffleRelease: '@localizer["AudioPlayerShuffleRelease"]',
|
||||
shuffleArtist: '@localizer["AudioPlayerShuffleArtist"]',
|
||||
shuffleLibrary: '@localizer["AudioPlayerShuffleLibrary"]',
|
||||
repeat: '@localizer["AudioPlayerRepeat"]',
|
||||
repeatOff: '@localizer["AudioPlayerRepeatOff"]',
|
||||
repeatAll: '@localizer["AudioPlayerRepeatAll"]',
|
||||
repeatOne: '@localizer["AudioPlayerRepeatOne"]',
|
||||
queue: '@localizer["AudioPlayerQueue"]'
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -71,6 +89,7 @@
|
||||
<script defer src="~/js/audio-player/audio-player-utils.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-errors.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-events.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-queue.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-download.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-render.js" asp-append-version="true"></script>
|
||||
<script defer src="~/js/audio-player/audio-player-decode.js" asp-append-version="true"></script>
|
||||
|
||||
@@ -1274,6 +1274,12 @@ body {
|
||||
border-top-width: 0px;
|
||||
}
|
||||
|
||||
/* The shuffle scope menu opens above the bar, so the bar lets it overflow while the menu is open. Every other state keeps
|
||||
the overflow hidden that collapses the bar to its height. */
|
||||
.audio-player-container.is-menu-open {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/* The 'hidden' attribute keeps the bar unrendered until the audio player script takes over, so that a page load
|
||||
never shows it, not even for a frame while the stylesheets settle. The script removes it once the bar is already
|
||||
in its hidden state, so the removal is never visible. */
|
||||
@@ -1412,13 +1418,21 @@ html.audio-player-initializing .audio-player-container {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.audio-player-transport {
|
||||
/* The queue controls hold the shuffle scope menu, the skip controls and the repeat toggle. They sit next to the play
|
||||
control, so the bar reads as one transport row. */
|
||||
.audio-player-queue-controls {
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.audio-player-play-pause {
|
||||
/* The button class is the current hook; the play-pause and mute class names are kept as aliases so a theme that targets
|
||||
those older hooks directly still gets the same box. */
|
||||
.audio-player-button,
|
||||
.audio-player-play-pause,
|
||||
.audio-player-mute {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -1427,9 +1441,113 @@ html.audio-player-initializing .audio-player-container {
|
||||
padding: 0px;
|
||||
background-color: transparent;
|
||||
border: 0px;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.audio-player-button:disabled,
|
||||
.audio-player-button.is-disabled,
|
||||
.audio-player-play-pause:disabled,
|
||||
.audio-player-play-pause.is-disabled,
|
||||
.audio-player-mute:disabled,
|
||||
.audio-player-mute.is-disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* The skip icons are drawn with CSS, so a theme restyles them without an image. */
|
||||
.audio-player-previous-icon,
|
||||
.audio-player-next-icon {
|
||||
display: block;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
border-style: solid;
|
||||
border-width: 5px 8px 5px 0px;
|
||||
border-color: transparent #E6E6E6 transparent transparent;
|
||||
}
|
||||
|
||||
.audio-player-previous-icon {
|
||||
box-shadow: -3px 0px 0px #E6E6E6;
|
||||
}
|
||||
|
||||
.audio-player-next-icon {
|
||||
border-width: 5px 0px 5px 8px;
|
||||
border-color: transparent transparent transparent #E6E6E6;
|
||||
box-shadow: 3px 0px 0px #E6E6E6;
|
||||
}
|
||||
|
||||
/* The shuffle and repeat glyphs are text, so a theme can replace them with its own imagery while keeping the hooks. */
|
||||
.audio-player-shuffle-control {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.audio-player-shuffle-icon,
|
||||
.audio-player-repeat-icon {
|
||||
display: block;
|
||||
font-size: 17px;
|
||||
line-height: 1;
|
||||
color: #E6E6E6;
|
||||
}
|
||||
|
||||
.audio-player-shuffle.is-active .audio-player-shuffle-icon,
|
||||
.audio-player-repeat.is-active .audio-player-repeat-icon {
|
||||
color: #6DCBFE;
|
||||
}
|
||||
|
||||
.audio-player-repeat {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.audio-player-repeat-one-badge {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
bottom: 2px;
|
||||
font-size: 9px;
|
||||
line-height: 1;
|
||||
color: #6DCBFE;
|
||||
}
|
||||
|
||||
.audio-player-repeat.is-one .audio-player-repeat-one-badge {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* The shuffle scope menu opens above the control, because the bar is anchored to the bottom of the page. */
|
||||
.audio-player-shuffle-menu {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
bottom: calc(100% + 6px);
|
||||
z-index: 998;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 150px;
|
||||
padding: 4px;
|
||||
background-color: #1C1C1C;
|
||||
border: 1px solid #444444;
|
||||
}
|
||||
|
||||
.audio-player-shuffle-menu[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.audio-player-shuffle-menu button {
|
||||
padding: 6px 8px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.audio-player-shuffle-menu button:hover,
|
||||
.audio-player-shuffle-menu button.is-selected {
|
||||
background-color: #2A2A2A;
|
||||
color: #6DCBFE;
|
||||
}
|
||||
|
||||
/* The play affordance is a right pointing triangle, and the pause affordance two bars, both drawn with CSS
|
||||
so that a theme can restyle them without an image. */
|
||||
.audio-player-play-pause-icon {
|
||||
@@ -1456,18 +1574,6 @@ html.audio-player-initializing .audio-player-container {
|
||||
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;
|
||||
@@ -1558,6 +1664,19 @@ html.audio-player-initializing .audio-player-container {
|
||||
gap: 12px;
|
||||
padding: 6px 8px;
|
||||
border-bottom: 1px solid #333333;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.audio-player-queue-item.is-played .audio-player-queue-item-title {
|
||||
color: #8A8A8A;
|
||||
}
|
||||
|
||||
.audio-player-queue-item.is-current .audio-player-queue-item-title {
|
||||
color: #6DCBFE;
|
||||
}
|
||||
|
||||
.audio-player-queue-item:focus {
|
||||
outline: 1px solid #6DCBFE;
|
||||
}
|
||||
|
||||
.audio-player-queue-item-title {
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
* whether a seek target is buffered, in which case the player never shows a loading state for a seek.
|
||||
* - discardCurrentAsync() (optional): releases the currently prepared track without destroying the engine, so a stop
|
||||
* during an automatic continuation does not leave the track it started loaded behind an idle player.
|
||||
* - cancelUpcomingAsync() (optional): drops a prefetched or appended handoff of the current track when the player queue is
|
||||
* replaced under it, for example when shuffle is turned on or off, so audio prepared from the old queue never plays.
|
||||
* - destroyAsync(): releases every resource the engine holds, including any audio context.
|
||||
*
|
||||
* The engine host
|
||||
@@ -175,8 +177,7 @@
|
||||
|
||||
/**
|
||||
* A registry of engine factories, keyed by name, used to resolve the engine the player runs with.
|
||||
* The later stages of the player register the real download, decode and render engine here; the
|
||||
* core module only registers the silent engine.
|
||||
* The real download, decode and render engine is registered here; the core module only registers the silent engine.
|
||||
*/
|
||||
class PlayerEngineRegistry {
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
// The container of a track could not be parsed into encoded packets, or the bytes it holds do not describe a stream the demuxer supports.
|
||||
DEMUX_FAILED: 'demux-failed',
|
||||
// The stored playback preferences of the user could not be read.
|
||||
PREFERENCES_LOAD_FAILED: 'preferences-load-failed'
|
||||
PREFERENCES_LOAD_FAILED: 'preferences-load-failed',
|
||||
// A play context, a queue batch or a shuffle batch could not be built from the web endpoints.
|
||||
QUEUE_LOAD_FAILED: 'queue-load-failed'
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Event bus of the audio player.
|
||||
*
|
||||
* The player is decoupled from its consumers (the player bar, the transport UI, the queue panel, themes) through a single observable.
|
||||
* The player is decoupled from its consumers (the player bar, the transport UI, the queue panel, themes) through a single observable.
|
||||
* Every module of the player publishes to this bus, and every consumer subscribes to it, so that no module needs a direct reference to another one.
|
||||
*/
|
||||
(function (LuminaAudioPlayer) {
|
||||
@@ -17,7 +17,11 @@
|
||||
STATE_CHANGED: 'statechange',
|
||||
// The currently playing track changed. Payload: the play descriptor.
|
||||
DESCRIPTOR_CHANGED: 'descriptorchange',
|
||||
// The queue changed. Payload: the ordered list of play descriptors.
|
||||
// The playable state of the queue changed: cursor, current entry, counts, repeat mode, shuffle mode or context.
|
||||
// Payload: the compact summary returned by getQueueStateSummary(), not the full queue.
|
||||
QUEUE_STATE_CHANGED: 'queuestatechange',
|
||||
// Deprecated legacy queue event. It keeps its original payload, the ordered list of play descriptors, and is emitted
|
||||
// only when a legacy consumer is subscribed. New code must use QUEUE_STATE_CHANGED and its compact summary.
|
||||
QUEUE_CHANGED: 'queuechange',
|
||||
// The playhead moved. Payload: { currentTime, duration }.
|
||||
TIME_UPDATE: 'timeupdate',
|
||||
@@ -81,6 +85,16 @@
|
||||
return () => this.off(event, handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether an event currently has any subscriber, so a producer can skip an expensive payload nobody reads.
|
||||
* @param {string} event - One of the {@link LuminaAudioPlayer.PlayerEvent} values.
|
||||
* @returns {boolean} True when the event has at least one handler.
|
||||
*/
|
||||
hasListeners(event) {
|
||||
const handlers = this.listeners.get(event);
|
||||
return !!handlers && handlers.size > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribes a handler to an event, removing it after the first emission.
|
||||
* @param {string} event - One of the {@link LuminaAudioPlayer.PlayerEvent} values.
|
||||
|
||||
@@ -16,16 +16,6 @@
|
||||
*/
|
||||
const MANIFEST_REQUEST_TIMEOUT_MS = 20000;
|
||||
|
||||
/**
|
||||
* Checks whether a value is a Guid, the only form the manifest route accepts for its Ids.
|
||||
* @param {*} value - The value to check.
|
||||
* @returns {boolean} True when the value is a Guid string.
|
||||
*/
|
||||
function isGuid(value) {
|
||||
return typeof value === 'string'
|
||||
&& /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the origin this module resolves relative URLs against. The page origin is used in a browser; a fixed local
|
||||
* origin keeps the route and origin checks testable in a host without a DOM.
|
||||
@@ -148,11 +138,11 @@
|
||||
if (!Object.prototype.hasOwnProperty.call(expectedIds, name))
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.ENGINE_LOAD_FAILED, 'The stream route template carries an unknown placeholder.');
|
||||
const expected = expectedIds[name];
|
||||
if (!isGuid(expected))
|
||||
if (!LuminaAudioPlayer.isGuid(expected))
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, `The play descriptor carries no valid ${name}.`, { field: name });
|
||||
const actual = streamSegments[index];
|
||||
// The path must describe the track of this descriptor, not merely another track of the same library.
|
||||
if (!isGuid(actual) || actual.toLowerCase() !== expected.toLowerCase())
|
||||
if (!LuminaAudioPlayer.isGuid(actual) || actual.toLowerCase() !== expected.toLowerCase())
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.ENGINE_LOAD_FAILED, 'The stream path does not belong to the expected track.');
|
||||
continue;
|
||||
}
|
||||
@@ -167,7 +157,7 @@
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.ENGINE_LOAD_FAILED, 'The stream path does not match the stream route.');
|
||||
}
|
||||
const libraryId = descriptor && descriptor.libraryId;
|
||||
if (!isGuid(libraryId))
|
||||
if (!LuminaAudioPlayer.isGuid(libraryId))
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The play descriptor carries no valid library Id.', { field: 'libraryId' });
|
||||
const requestedLibraryIds = url.searchParams.getAll('libraryId');
|
||||
if (requestedLibraryIds.length !== 1 || requestedLibraryIds[0].toLowerCase() !== libraryId.toLowerCase())
|
||||
@@ -256,10 +246,10 @@
|
||||
if (!Object.prototype.hasOwnProperty.call(expectedIds, name))
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.ENGINE_LOAD_FAILED, 'The segment route template carries an unknown placeholder.');
|
||||
const expected = expectedIds[name];
|
||||
if (!isGuid(expected))
|
||||
if (!LuminaAudioPlayer.isGuid(expected))
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, `The play descriptor carries no valid ${name}.`, { field: name });
|
||||
// The path must describe the track of this descriptor, not merely another track of the same library.
|
||||
if (!isGuid(actualSegment) || actualSegment.toLowerCase() !== expected.toLowerCase())
|
||||
if (!LuminaAudioPlayer.isGuid(actualSegment) || actualSegment.toLowerCase() !== expected.toLowerCase())
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.ENGINE_LOAD_FAILED, 'The segment path does not belong to the expected track.');
|
||||
continue;
|
||||
}
|
||||
@@ -267,7 +257,7 @@
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.ENGINE_LOAD_FAILED, 'The segment path does not match the segment route.');
|
||||
}
|
||||
const libraryId = descriptor && descriptor.libraryId;
|
||||
if (!isGuid(libraryId))
|
||||
if (!LuminaAudioPlayer.isGuid(libraryId))
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The play descriptor carries no valid library Id.', { field: 'libraryId' });
|
||||
const requestedLibraryIds = url.searchParams.getAll('libraryId');
|
||||
if (requestedLibraryIds.length !== 1 || requestedLibraryIds[0].toLowerCase() !== libraryId.toLowerCase())
|
||||
@@ -325,7 +315,7 @@
|
||||
if (!ids[name])
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, `The play descriptor carries no ${name}.`, { field: name });
|
||||
// The manifest route only accepts Guids, and a value that is not a Guid must never be interpolated into a path the browser resolves against this origin.
|
||||
if (!isGuid(ids[name]))
|
||||
if (!LuminaAudioPlayer.isGuid(ids[name]))
|
||||
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, `The play descriptor carries an invalid ${name}.`, { field: name });
|
||||
}
|
||||
let url = String(template)
|
||||
|
||||
+34
@@ -272,6 +272,40 @@
|
||||
await this.teardownPlaybackAsync(null, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops the next item and the prefetch of the current track, without touching the audio that is already playing.
|
||||
*
|
||||
* The player calls it when it replaces the queue under a playing track, for example when the user turns shuffle on or
|
||||
* off. A prefetched or appended handoff was prepared from the queue that no longer exists, so leaving it in place
|
||||
* would play a track the queue no longer describes. When the handoff is already audible it is left alone, because
|
||||
* truncating it would rewind audio that has played.
|
||||
* @returns {Promise<void>} A promise that completes when the upcoming handoff was released.
|
||||
*/
|
||||
async cancelUpcomingAsync() {
|
||||
if (this.destroyed)
|
||||
return;
|
||||
const item = this.current;
|
||||
if (!item)
|
||||
return;
|
||||
await this.cancelPrefetchAsync(item);
|
||||
item.continueToEntry = null;
|
||||
const next = this.nextItem;
|
||||
if (!next)
|
||||
return;
|
||||
// A handoff that has not reached the playhead can be removed from the schedule; one that is already audible stays.
|
||||
if (typeof this.renderer.truncateScheduleAt !== 'function'
|
||||
|| next.base <= this.renderer.getCurrentTime())
|
||||
return;
|
||||
this.nextItem = null;
|
||||
if (typeof this.renderer.cancelTrackGainChange === 'function')
|
||||
this.renderer.cancelTrackGainChange();
|
||||
this.renderer.truncateScheduleAt(next.base);
|
||||
this.renderer.markStreamComplete();
|
||||
this.disposeItemAsync(next).catch((error) => {
|
||||
console.debug('Audio player: the upcoming track of the replaced queue could not be released.', error);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts, or resumes, audible playback.
|
||||
* @returns {Promise<void>} A promise that completes when the renderer is running.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -39,7 +39,7 @@
|
||||
* markStreamComplete. Completion is never inferred from the duration of the manifest, because that duration is a whole
|
||||
* number of seconds and a decode that is still on its way near the end would then have its last frames cut off. A drained
|
||||
* schedule that is not complete is a gap: the renderer keeps playing, reports the playhead pinned to the frontier of the
|
||||
* scheduled audio, and waits for more, which is what lets the later stages treat a gap as an underrun and recover from
|
||||
* scheduled audio, and waits for more, which is what lets the pipeline treat a gap as an underrun and recover from
|
||||
* it instead of ending the track. The end is also detected from the end of the last source, so a tab that the browser
|
||||
* hides, and whose animation frame loop it suspends, still reaches the end while the audio keeps playing. The end is
|
||||
* reported through onEnded once per configured track: a buffer scheduled after an end resumes playback, but the callback
|
||||
|
||||
@@ -10,6 +10,28 @@
|
||||
(function (LuminaAudioPlayer) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Checks whether a value is a Guid string, the only form the routes and the player descriptors accept for their Ids.
|
||||
* @param {*} value - The value to check.
|
||||
* @returns {boolean} True when the value is a Guid string.
|
||||
*/
|
||||
LuminaAudioPlayer.isGuid = function isGuid(value) {
|
||||
return typeof value === 'string'
|
||||
&& /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
||||
};
|
||||
|
||||
/**
|
||||
* Coerces an Id into a non empty string, or an empty string when it carries no value.
|
||||
* @param {*} value - The Id to coerce.
|
||||
* @returns {string} The Id as a string, or an empty string.
|
||||
*/
|
||||
LuminaAudioPlayer.toIdString = function toIdString(value) {
|
||||
if (value === null || value === undefined)
|
||||
return '';
|
||||
const text = String(value).trim();
|
||||
return text === '' ? '' : text;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clamps a number into an inclusive range, defaulting a non finite value to the lower bound.
|
||||
* @param {number} value - The value to clamp.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user