Significantly improve the media player UX

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2022-11-27 00:53:36 +01:00
parent 445d5f45f5
commit 60aaaf7132
4 changed files with 224 additions and 184 deletions
+99 -59
View File
@@ -8,6 +8,8 @@
.block-media > a > .content,
.block-media > .content {
object-fit: contain;
object-position: center center;
}
.block-media > figcaption {
@@ -22,6 +24,7 @@
// --------------------------------------------------------------------------------
// Block: Media Player
// --------------------------------------------------------------------------------
$media-player-button-size: 1.5rem;
.block-media.hide {
cursor: none;
@@ -29,144 +32,181 @@
.block-media > .top,
.block-media > .bottom {
display: block;
margin: 0;
padding: 0.5rem .5rem;
padding: 0.2rem 0.5rem;
}
.block-media > .top {
background: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 80%);
position: absolute;
top: 0;
left: 0;
right: 0;
display: grid;
grid-template-columns: 1;
grid-template-rows: 1;
justify-content: stretch;
padding-bottom: 1rem;
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: stretch;
gap: 0;
transition: top ease-in-out 333ms, opacity ease-in-out 333ms;
align-content: stretch;
gap: 0.5rem;
background: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 80%);
transition: top ease-in-out 100ms, opacity ease-in-out 100s;
opacity: 1.0;
overflow: hidden;
user-select: none;
}
.block-media.hide > .top {
top: -100%;
opacity: 0.0;
transition: top ease-in-out 500ms, opacity ease-in-out 500s;
}
.block-media > .top > .variant {
// ToDo: Style this
flex-grow: 1;
}
.block-media > .bottom {
background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 80%);
position: absolute;
bottom: 0;
left: 0;
right: 0;
display: grid;
grid-template-columns: max-content 1fr max-content max-content;
justify-content: stretch;
padding-top: 1rem;
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: stretch;
align-content: stretch;
gap: 0.5rem;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 80%);
transition: top ease-in-out 100ms, opacity ease-in-out 100s;
opacity: 1.0;
overflow: hidden;
user-select: none;
transition: bottom ease-in-out 333ms, opacity ease-in-out 333ms;
opacity: 1.0;
}
.block-media.hide > .bottom {
bottom: -100%;
opacity: 0.0;
transition: top ease-in-out 500ms, opacity ease-in-out 500s;
}
.block-media > .bottom > .play {
width: 2rem;
height: 2rem;
flex-grow: 0;
display: block;
margin: 0;
padding: 0;
font-size: 2rem;
line-height: 2rem;
width: $media-player-button-size;
height: $media-player-button-size;
font-size: $media-player-button-size;
line-height: $media-player-button-size;
text-align: center;
user-select: none;
}
.block-media > .bottom > .play.playing {
}
.block-media > .bottom > .playback {
.block-media > .bottom > .time {
margin: 0;
padding: 0;
display: grid;
grid-template-columns: max-content 1fr max-content;
justify-content: stretch;
align-items: stretch;
gap: 0.5rem;
user-select: none;
}
width: auto;
height: $media-player-button-size;
flex-grow: 0;
flex-shrink: 0;
flex-basis: auto;
.block-media > .bottom > .playback > .time {
display: block;
height: 2rem;
margin: 0;
padding: 0;
text-align: right;
line-height: 2rem;
line-height: $media-player-button-size;
user-select: auto;
}
.block-media > .bottom > .playback > .progress {
display: block;
.block-media > .bottom > .progress {
margin: 0;
padding: 0;
width: auto;
min-width: 5rem;
height: 100%;
user-select: none;
}
flex-grow: 5;
flex-shrink: 1;
.block-media > .bottom > .audio {
margin: 0;
padding: 0;
display: grid;
grid-template-columns: max-content 1fr;
justify-content: stretch;
align-items: stretch;
gap: 0.5rem;
user-select: none;
}
.block-media > .bottom > .audio > .mute {
display: block;
user-select: none;
}
.block-media > .bottom > .mute {
margin: 0;
padding: 0;
width: 2rem;
height: 2rem;
font-size: 2rem;
line-height: 2rem;
width: $media-player-button-size;
height: $media-player-button-size;
flex-grow: 0;
flex-shrink: 0;
flex-basis: auto;
display: block;
font-size: $media-player-button-size;
line-height: $media-player-button-size;
text-align: center;
user-select: none;
}
.block-media > .bottom > .audio > .mute.muted {
.block-media > .bottom > .mute.muted {
}
.block-media > .bottom > .audio > .volume {
display: block;
.block-media > .bottom > .volume {
margin: 0;
padding: 0;
width: auto;
min-width: 3rem;
max-width: 6rem;
height: 100%;
flex-grow: 1;
flex-shrink: 5;
flex-basis: auto;
display: block;
user-select: none;
}
.block-media > .bottom > .fullscreen {
width: 2rem;
height: 2rem;
margin: 0;
padding: 0;
font-size: 2rem;
line-height: 2rem;
width: $media-player-button-size;
height: $media-player-button-size;
flex-grow: 0;
flex-shrink: 0;
flex-basis: auto;
display: block;
font-size: $media-player-button-size;
line-height: $media-player-button-size;
text-align: center;
user-select: none;
}
@media (max-width: 500px) {
.block-media > .bottom > .time {
display: none;
}
}
@media (max-width: 350px) {
.block-media > .bottom > .volume {
display: none;
}
}
@media (max-width: 250px) {
.block-media > .bottom > .play,
.block-media > .bottom > .mute,
.block-media > .bottom > .fullscreen {
display: none;
}
}
// --------------------------------------------------------------------------------
// Block: Media > Audio