Audio media attachments (#4741)

* Add audio-player component

* Enhance audio player functionality and styles

- Adjust audio player layout and styles in CSS for better spacing and alignment.
- Add audio element to message template in HTML.
- Implement audio attachment handling in JavaScript, including a new AudioPlayer class.
- Update media attachment structure to include titles for audio files.
- Extend supported media file types in constants.

* Add audio inlining control

* Fix file formats list

* Simplify hints

* Add to prompt

* Add progress title hint

* Add to scrollOnMediaLoad

* Add audio size hint

* Add gallery controls

* Delete removed media attachments from server

* Adjust min width

* No-op when swiping a singular media

* Fix clean-up

* Fix silent deletion logic

* More accurate media prompt estimations

* Round durations with ceiling function

* Adjust rounding logic

* you don't have to say it twice

* Export deleteFileFromServer

* Don't reference module from HTML

* Clean-up styles

* Move formatTime to utils

* Add fa-fw to delete
This commit is contained in:
Cohee
2025-11-05 00:53:23 +02:00
committed by GitHub
parent 447c271b36
commit 2577e35c0b
27 changed files with 1061 additions and 113 deletions
+93
View File
@@ -65,3 +65,96 @@
display: flex;
text-align: left;
}
/* Audio Player Styles */
.mes_audio_container {
cursor: default;
display: flex;
width: fit-content;
min-width: min(350px, 100%);
max-width: 100%;
background-color: var(--white20a);
border: 2px solid var(--SmartThemeBorderColor);
padding: 0.5em 1em;
border-radius: 15px;
}
.mes_audio_container .mes_img_swipes {
position: unset;
opacity: unset;
background: none;
padding: 0;
}
.mes_audio_container .mes_img_swipes .right_menu_button {
filter: brightness(75%);
text-shadow: none;
}
.mes_audio_container .mes_img_swipes .mes_img_swipe_counter {
filter: none;
text-shadow: none;
}
.audio-player {
display: flex;
flex-direction: column;
gap: 5px;
}
.audio-player-header {
display: flex;
flex-direction: row;
gap: 15px;
align-items: center;
justify-content: space-between;
}
.audio-player-title {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.audio-player-controls {
display: flex;
align-items: center;
gap: 10px;
}
.audio-player-play-pause,
.audio-player-volume {
background: none;
border: none;
}
.audio-player-time-separator {
font-size: 0.9em;
text-align: center;
}
.audio-player-current-time,
.audio-player-total-time {
font-size: 0.9em;
color: var(--SmartThemeQuoteColor);
min-width: 40px;
text-align: center;
}
.audio-player-progress {
flex: 1;
height: 6px;
background-color: var(--black30a);
border-radius: 3px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.audio-player-progress-bar {
height: 100%;
background-color: var(--SmartThemeEmColor);
border-radius: 3px;
transition: width 0.1s linear;
width: 0%;
}