Player icons patch (#1636)

* Adjust player icon size & position on desktop & mobile

* Adjust control-bar position

* Fix chapter button offset
This commit is contained in:
Rave | 図書館猫 2022-06-05 13:32:21 +02:00 committed by GitHub
parent 2762d43224
commit e83d667b25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 143 additions and 53 deletions

View file

@ -207,7 +207,7 @@ export const lastBandwidthSelector = function() {
if (hlsQualitySelector?.getCurrentQuality() === 'auto') {
const qualityLabel = selectedBandwidth.attributes.RESOLUTION.height + 'p';
hlsQualitySelector._qualityButton.menuButton_.$('.vjs-icon-placeholder').innerHTML = `${__('Auto --[Video quality. Short form]--')}<span>${qualityLabel}</span>`;
hlsQualitySelector._qualityButton.menuButton_.$('.vjs-icon-placeholder').innerHTML = `<span>${__('Auto --[Video quality. Short form]--')}<span>${qualityLabel}</span></span>`;
}
return selectedBandwidth;

View file

@ -178,11 +178,16 @@ a.button--alt {
display: block;
order: 1;
background-repeat: no-repeat;
background-position: center;
transform: scale(1.4);
margin-top: -4px;
// background-position: center;
background-position: center 9.5px;
background-size: 28px;
padding: 10px;
opacity: 0.8 !important;
margin-left: var(--spacing-xs);
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-monitor'%3E%3Crect x='2' y='3' width='20' height='14' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='8' y1='21' x2='16' y2='21'%3E%3C/line%3E%3Cline x1='12' y1='17' x2='12' y2='21'%3E%3C/line%3E%3C/svg%3E");
&:hover {
opacity: 1 !important;
}
}
&:focus:not(:focus-visible) {
@ -200,12 +205,17 @@ a.button--alt {
display: block;
background-repeat: no-repeat;
background-position: center;
background-size: 28px;
&:focus:not(:focus-visible) {
display: block;
background-repeat: no-repeat;
background-position: center;
}
@media (max-width: $breakpoint-small) {
background-size: 24px;
}
}
.vjs-button--play-next.vjs-button {
@ -237,7 +247,7 @@ a.button--alt {
//
// TEMP: for now, just hardcode the left-right margin so that it looks
// equally spaced compared to its siblings.
margin: 9px 0.5rem auto 0.7rem;
margin: auto 0.5rem auto 0.7rem;
order: 1;
width: 24px;

View file

@ -535,10 +535,14 @@
// ****************************************************************************
// DRY: we'll soon move vjs items to videojs.scss, so just duplicate these for now.
$control-bar-height: 2.5rem;
// $control-bar-height: 48px;
$control-bar-height: 48px;
$control-bar-height-mobile: 44px;
$control-bar-font-size: 0.9rem;
$control-bar-popup-font-size: 0.8rem;
$control-bar-icon-size: 1.9rem;
// $control-bar-icon-size: 1.9rem;
$control-bar-icon-size: 36px;
$control-bar-icon-size-mobile: 30px;
.video-js-parent {
height: 100%;
@ -565,22 +569,31 @@ $control-bar-icon-size: 1.9rem;
.vjs-control-bar {
.vjs-volume-panel {
.vjs-volume-horizontal {
margin-top: 0 !important;
margin-top: 5.5px !important;
height: $control-bar-height !important;
@media (max-width: $breakpoint-small) {
height: $control-bar-height-mobile !important;
}
}
&:hover {
.vjs-volume-horizontal {
margin-top: 0;
margin-top: 5.5px !important;
height: $control-bar-height !important;
@media (max-width: $breakpoint-small) {
height: $control-bar-height-mobile !important;
}
}
}
}
.vjs-time-control {
margin-left: var(--spacing-xs);
line-height: $control-bar-icon-size;
line-height: $control-bar-height;
font-size: $control-bar-font-size;
display: flex;
@media (max-width: $breakpoint-small) {
line-height: $control-bar-height-mobile !important;
}
}
.vjs-current-time {
@ -609,37 +622,57 @@ $control-bar-icon-size: 1.9rem;
// control-bar: menu, button and icon
.vjs-control-bar {
// margin-bottom:-4px;
.vjs-menu-button {
font-size: $control-bar-font-size;
line-height: $control-bar-height;
}
.vjs-icon-placeholder {
// font-size: $control-bar-icon-size; // videojs icon font
line-height: $control-bar-height;
}
.vjs-icon-placeholder::before {
font-size: $control-bar-icon-size;
line-height: $control-bar-icon-size;
line-height: $control-bar-height;
@media (max-width: $breakpoint-small) {
font-size: $control-bar-icon-size-mobile !important;
line-height: $control-bar-height-mobile !important;
}
}
.vjs-quality-selector {
margin-top: -6px;
// margin-top: -6px;
.vjs-icon-placeholder {
font-size: $control-bar-font-size;
span {
display: block;
margin-left: 24%;
margin-right: 24%;
font-size: 0.6rem;
background: var(--color-primary);
font-weight: var(--font-weight-bold);
border-radius: 4px;
margin-top: -1px;
//padding-top: 1px;
padding-top: 0;
line-height: 13px;
margin-top: -3px;
span {
display: block;
margin-left: 24%;
margin-right: 24%;
font-size: 0.6rem;
background: var(--color-primary);
font-weight: var(--font-weight-bold);
border-radius: 4px;
margin-top: -1px;
//padding-top: 1px;
padding-top: 0;
line-height: 13px;
}
}
}
@media (max-width: $breakpoint-small) {
width: 3rem;
.vjs-icon-placeholder {
span {
span {
margin-left: 20%;
margin-right: 20%;
// font-size: 0.5rem;
}
}
}
}
}
@ -654,11 +687,10 @@ $control-bar-icon-size: 1.9rem;
}
}
.vjs-playback-rate {
margin-left: var(--spacing-xs);
div.vjs-playback-rate {
.vjs-playback-rate-value {
font-size: $control-bar-font-size;
line-height: $control-bar-icon-size;
line-height: $control-bar-height;
}
.vjs-menu {
@ -667,11 +699,15 @@ $control-bar-icon-size: 1.9rem;
}
@media (max-width: $breakpoint-small) {
margin-right: calc(var(--spacing-s) * -1) !important;
margin-right: calc(var(--spacing-xs) * -1) !important;
width: 3rem;
.vjs-playback-rate-value {
line-height: $control-bar-height-mobile;
}
}
}
.vjs-chapters-button {
div.vjs-chapters-button {
.vjs-menu {
width: 20em;
left: -3em;
@ -681,17 +717,34 @@ $control-bar-icon-size: 1.9rem;
text-align: left;
padding: var(--spacing-xxxs) var(--spacing-s);
}
button {
// font-size:inherit;
// line-height:10px;
}
}
button.vjs-chapters-button {
display: block;
margin-top: -0px;
}
.vjs-chromecast-button,
.vjs-airplay-button {
margin-top: -4px;
margin-left: var(--spacing-xs);
margin-right: 2px;
.vjs-icon-placeholder {
$chromecast-icon-size: 25px;
$chromecast-icon-size: 30.5px;
margin-top: 1.5px;
width: $chromecast-icon-size;
height: $chromecast-icon-size;
}
@media (max-width: $breakpoint-small) {
.vjs-icon-placeholder {
margin-top: 2px;
width: 23px;
height: 23px;
}
}
}
}
@ -710,6 +763,7 @@ $control-bar-icon-size: 1.9rem;
margin-right: var(--spacing-s);
margin-left: var(--spacing-xs);
@media (max-width: $breakpoint-small) {
width: 2.5rem;
margin-right: 0;
}
}
@ -718,19 +772,17 @@ $control-bar-icon-size: 1.9rem;
.vjs-button--play-next,
.vjs-mute-control {
.vjs-icon-placeholder::before {
font-size: 1.7rem;
// font-size: 1.9rem;
font-size: $control-bar-icon-size;
}
@media (max-width: $breakpoint-small) {
width: 2.25rem;
}
}
.vjs-button--play-previous,
.vjs-button--play-next {
margin-top: -5px;
}
.vjs-button--play-next {
margin-left: var(--spacing-xs);
margin-right: var(--spacing-xs);
}
}

View file

@ -1,7 +1,9 @@
$control-bar-height: 2.5rem;
// $control-bar-height: 2.6rem;
$control-bar-height: 48px;
$control-bar-height-mobile: 44px;
$control-bar-font-size: 0.8rem;
$control-bar-popup-font-size: 0.8rem;
$control-bar-icon-size: 0.8rem;
// $control-bar-icon-size: 0.8rem;
.video-js {
font-size: 12px;
@ -22,6 +24,10 @@ $control-bar-icon-size: 0.8rem;
background: rgba(20, 20, 20, 0.45);
background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 10%, rgba(0, 0, 0, 0) 100%);
}
@media (max-width: $breakpoint-small) {
height: $control-bar-height-mobile;
}
}
@media (min-width: $breakpoint-small) {
@ -48,13 +54,13 @@ $control-bar-icon-size: 0.8rem;
display: block;
align-items: center;
width: calc(100% - var(--spacing-m) * 2);
height: 1rem;
height: 2px;
bottom: 90%;
margin: 1px var(--spacing-m) !important;
margin: 1px var(--spacing-m) 7px !important;
@media (max-width: $breakpoint-small) {
width: calc(100% - var(--spacing-s) * 2);
margin: 1px var(--spacing-s) !important;
margin: 1px var(--spacing-s) 7px !important;
}
.vjs-vtt-thumbnail-display {
@ -135,7 +141,7 @@ $control-bar-icon-size: 0.8rem;
.vjs-volume-control.vjs-volume-horizontal {
transition: 0.1s;
margin-top: -2px !important;
// margin-top: -2px !important;
}
}
}
@ -204,7 +210,7 @@ $control-bar-icon-size: 0.8rem;
border-radius: var(--border-radius);
border: 2px solid var(--color-header-background);
max-height: 20em;
margin-bottom: -3px; // Prevents accidental dismissal when the gap is hovered.
// margin-bottom: -3px; // Prevents accidental dismissal when the gap is hovered.
li {
font-size: $control-bar-popup-font-size;
@ -261,8 +267,11 @@ $control-bar-icon-size: 0.8rem;
.vjs-chromecast-button {
.vjs-icon-placeholder {
width: 19px;
height: 19px;
width: 22px;
height: 22px;
}
@media (max-width: $breakpoint-small) {
width: 2.5rem !important;
}
}
@ -329,14 +338,33 @@ button.vjs-big-play-button {
}
.vjs-seek-to-live-control {
margin-top: -4px !important;
margin-left: calc(var(--spacing-s) + 4px) !important;
@media (max-width: $breakpoint-small) {
padding-left: 0 !important;
}
.vjs-icon-placeholder {
&::before {
font-size: 0.9rem !important;
font-size: 1rem !important;
}
}
.vjs-seek-to-live-text {
font-size: $control-bar-font-size;
}
@media (max-width: $breakpoint-small) {
padding-left: 0 !important;
.vjs-icon-placeholder {
&::before {
font-size: 22px !important;
}
}
}
}
.video-js {
.vjs-seek-to-live-control {
@media (max-width: $breakpoint-small) {
padding-left: 0 !important;
.vjs-icon-placeholder {
&::before {
font-size: 14px !important;
}
}
}
}
}
@ -376,16 +404,16 @@ button.vjs-big-play-button {
.vjs-custom-control-spacer {
order: 9 !important;
}
.vjs-chapters-button {
.vjs-subs-caps-button {
order: 10 !important;
}
.vjs-subs-caps-button {
.vjs-button--autoplay-next {
order: 11 !important;
}
.vjs-button--autoplay-next {
.vjs-playback-rate {
order: 12 !important;
}
.vjs-playback-rate {
.vjs-chapters-button {
order: 13 !important;
}
.vjs-quality-selector {