365 lines
No EOL
9.3 KiB
JavaScript
365 lines
No EOL
9.3 KiB
JavaScript
import {
|
|
PlayIcon,
|
|
PauseIcon,
|
|
FullcreenIcon,
|
|
CaptionsIcon,
|
|
Backward15Icon,
|
|
Forward15Icon,
|
|
VolumeHighIcon
|
|
} from '../get'
|
|
|
|
export var Controls = `
|
|
<h2 class="zorn-title hide"></h2>
|
|
<div oncontextmenu="return false" class="zorn-player-controls">
|
|
<div class="row-2">
|
|
<div class="video-progress">
|
|
<progress id="progress-bar" value="0" min="0"></progress>
|
|
<input class="seek" id="seek" value="0" min="0" type="range" step="1">
|
|
<div class="seek-tooltip" id="seek-tooltip">00:00</div>
|
|
</div>
|
|
</div>
|
|
<div class="row-1">
|
|
<div class="row-1-start">
|
|
<div class="volume-controls">
|
|
<button data-title="Mute (m)" class="volume-button" id="volume-button">${VolumeHighIcon}</button>
|
|
<input class="volume" id="volume" value="1" type="range" max="1" min="0" step="0.01"/>
|
|
</div>
|
|
<div class="time">
|
|
<time id="time-elapsed">00:00</time>
|
|
<span> / </span>
|
|
<time id="duration">00:00</time>
|
|
</div>
|
|
</div>
|
|
<div class="row-1-center">
|
|
<button id="skip-back">${Backward15Icon}</button>
|
|
<button id="play-pause">${PlayIcon}</button>
|
|
<button id="skip-forth">${Forward15Icon}</button>
|
|
</div>
|
|
<div class="row-1-end">
|
|
<button id="subtitles">${CaptionsIcon}</button>
|
|
<button id="fullscreen">${FullcreenIcon}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<style>
|
|
:root {
|
|
--zorn-progress-bar-bg: rgba(100, 100, 100, 0.5);
|
|
--zorn-progress-bar: rgba(255, 0, 0, 0.5);
|
|
--zorn-thumb: red;
|
|
--zorn-rounded-corners: 4px;
|
|
}
|
|
.zorn-context-menu {
|
|
background: linear-gradient(45deg, #0a141c 0%, rgba(10, 20, 28, 1) 100%);
|
|
border-radius: 6px;
|
|
border: 1px rgba(255, 255, 255, 0.08) solid;
|
|
}
|
|
.zorn-context-menu ul {
|
|
list-style: none;
|
|
margin: 0px;
|
|
padding: 0px;
|
|
}
|
|
.zorn-context-menu ul li {
|
|
padding: 8px 32px 8px 16px;
|
|
margin: 4px;
|
|
border-radius: 4px;
|
|
font-family: arial;
|
|
}
|
|
.zorn-context-menu ul li:hover {
|
|
background: rgba(255, 255, 255, 0.1);
|
|
cursor: pointer;
|
|
}
|
|
.zorn-context-menu ul li i {
|
|
font-size: 14px;
|
|
margin-right: 12px;
|
|
width: 12px;
|
|
}
|
|
.video-container {
|
|
position: relative;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
font-family: Arial, Helvetica, sans-serif;
|
|
color: white;
|
|
}
|
|
.video-container .zorn-player-dialogs #buffering {
|
|
display: none;
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
padding: 0px 24px;
|
|
border-radius: 6px;
|
|
}
|
|
.video-container .zorn-player-dialogs #buffering h2 {
|
|
font-size: 52px;
|
|
}
|
|
.video-container .zorn-player-dialogs #invalid-src {
|
|
display: none;
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 24px;
|
|
transform: translate(0px, -50%);
|
|
padding: 0px 24px;
|
|
border-radius: 6px;
|
|
}
|
|
.video-container .zorn-player-dialogs #invalid-src h2 {
|
|
font-size: 52px;
|
|
}
|
|
.video-container .zorn-player {
|
|
display: inline-flex;
|
|
}
|
|
.video-container .zorn-title {
|
|
display: none;
|
|
position: absolute;
|
|
top: 0px;
|
|
background: #000;
|
|
width: auto;
|
|
margin: 12px;
|
|
padding: 12px 24px;
|
|
border-radius: 10px;
|
|
font-size: 18px;
|
|
}
|
|
.video-container .hide {
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
}
|
|
.video-container .zorn-player-title {
|
|
position: absolute;
|
|
top: 0px;
|
|
width: 100%;
|
|
background-image: linear-gradient(to top, rgba(12, 12, 12, 0), rgba(12, 12, 12, 0.75));
|
|
padding: 12px 24px;
|
|
font-size: 18px;
|
|
font-weight: bold;
|
|
}
|
|
.video-container .subtitles-menu {
|
|
display: none;
|
|
position: absolute;
|
|
right: 60px;
|
|
bottom: 50px;
|
|
background: #000 9;
|
|
list-style: none;
|
|
padding: 6px;
|
|
border-radius: 6px;
|
|
}
|
|
.video-container .subtitles-menu button {
|
|
background-color: transparent;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 4px;
|
|
width: 100%;
|
|
text-align: left;
|
|
padding: 6px 12px;
|
|
cursor: pointer;
|
|
}
|
|
.video-container .subtitles-menu button:hover {
|
|
background: #fff 29;
|
|
}
|
|
.video-container .subtitles-menu .hide {
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
}
|
|
.video-container .zorn-player-controls {
|
|
display: inline-flex;
|
|
right: 0;
|
|
left: 0;
|
|
padding: 10px;
|
|
position: absolute;
|
|
bottom: -1px;
|
|
transition: all 0.2s ease;
|
|
background-image: linear-gradient(to bottom, rgba(12, 12, 12, 0), rgba(12, 12, 12, 0.75));
|
|
flex-direction: inherit;
|
|
}
|
|
.video-container .zorn-player-controls .row-1 {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
width: 100%;
|
|
}
|
|
.video-container .zorn-player-controls .row-1-start {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.video-container .zorn-player-controls .row-1-center {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
.video-container .zorn-player-controls .row-1-end {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.video-container .zorn-player-controls button {
|
|
aspect-ratio: 1;
|
|
height: 32px;
|
|
width: 32px;
|
|
color: white;
|
|
background-color: transparent;
|
|
border: none;
|
|
margin: 0px 6px;
|
|
}
|
|
.video-container .zorn-player-controls button:hover {
|
|
background: rgba(44, 44, 44, 0.6);
|
|
border-radius: 6px;
|
|
}
|
|
.video-container .zorn-player-controls .volume-controls:hover > #volume {
|
|
opacity: 1;
|
|
transition: 0.3s opacity, 0.3s width;
|
|
margin: 0px;
|
|
width: 72px;
|
|
}
|
|
.video-container .zorn-player-controls #volume {
|
|
opacity: 0;
|
|
transition: 0.3s opacity, 0.3s width;
|
|
margin: 0px -6px;
|
|
width: 0px;
|
|
}
|
|
.video-container .zorn-player-controls #volume-button svg {
|
|
aspect-ratio: 1;
|
|
height: 16px;
|
|
width: 16px;
|
|
fill: white;
|
|
padding: 3px 0px 0px 0px;
|
|
}
|
|
.video-container .zorn-player-controls .video-progress {
|
|
position: relative;
|
|
height: 6.4px;
|
|
margin: 24px 0px;
|
|
width: 100%;
|
|
}
|
|
.video-container .zorn-player-controls progress {
|
|
border-radius: 1rem;
|
|
width: 100%;
|
|
height: 8.4px;
|
|
position: absolute;
|
|
top: 0;
|
|
}
|
|
.video-container .zorn-player-controls progress::-webkit-progress-bar {
|
|
border-radius: 1rem;
|
|
background: var(--zorn-progress-bar-bg);
|
|
}
|
|
.video-container .zorn-player-controls progress::-webkit-progress-value {
|
|
background: var(--zorn-progress-bar);
|
|
border-radius: 1rem;
|
|
}
|
|
.video-container .zorn-player-controls progress::-moz-progress-bar {
|
|
border-radius: 1rem;
|
|
background: var(--zorn-progress-bar-bg);
|
|
}
|
|
.video-container .zorn-player-controls .seek {
|
|
position: absolute;
|
|
top: 0;
|
|
width: 100%;
|
|
cursor: pointer;
|
|
margin: 0;
|
|
}
|
|
.video-container .zorn-player-controls .seek:hover + .seek-tooltip {
|
|
display: block;
|
|
}
|
|
.video-container .zorn-player-controls .seek-tooltip {
|
|
display: none;
|
|
position: relative;
|
|
top: -32px;
|
|
margin-left: -30px;
|
|
font-size: 12px;
|
|
content: attr(data-title);
|
|
font-weight: bold;
|
|
color: #fff;
|
|
background-color: rgba(0, 0, 0, .5);
|
|
border-radius: 4px;
|
|
padding: 6px;
|
|
width: fit-content;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range] {
|
|
height: 8.4px;
|
|
background: transparent;
|
|
cursor: pointer;
|
|
opacity: 0;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range]:focus {
|
|
outline: none;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range]:focus::-webkit-slider-runnable-track {
|
|
background: transparent;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range]:focus::-moz-range-track {
|
|
outline: none;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range]::-webkit-slider-runnable-track {
|
|
width: 100%;
|
|
cursor: pointer;
|
|
border-radius: 1.3px;
|
|
-webkit-appearance: none;
|
|
transition: all 0.4s ease;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range]::-webkit-slider-thumb {
|
|
height: 12px;
|
|
width: 12px;
|
|
border-radius: 10px;
|
|
background: var(--zorn-thumb);
|
|
cursor: pointer;
|
|
-webkit-appearance: none;
|
|
margin-left: -1px;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range]::-moz-range-track {
|
|
width: 100%;
|
|
height: 8.4px;
|
|
cursor: pointer;
|
|
border: 1px solid transparent;
|
|
background: transparent;
|
|
border-radius: 0;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range].volume {
|
|
height: 5px;
|
|
background-color: #fff;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range].volume::-webkit-slider-runnable-track {
|
|
background-color: transparent;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range].volume::-webkit-slider-thumb {
|
|
margin-left: 0;
|
|
height: 14px;
|
|
width: 14px;
|
|
background: #fff;
|
|
}
|
|
.video-container .zorn-player-controls input[type=range].volume::-moz-range-thumb {
|
|
border: 1px solid #fff;
|
|
background: #fff;
|
|
}
|
|
.video-container .zorn-player-controls input[type="range"]::-moz-range-thumb {
|
|
height: 12px;
|
|
width: 12px;
|
|
border-radius: 10px;
|
|
border: none;
|
|
background: var(--zorn-thumb);
|
|
cursor: pointer;
|
|
}
|
|
.video-container .zorn-player-controls .hide {
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
}
|
|
.video-container .zorn-player-controls #progress-bar {
|
|
background: var(--zorn-progress-bar-bg);
|
|
border: none;
|
|
border-radius: 10px;
|
|
}
|
|
div#buffering {
|
|
position: absolute;
|
|
top: 0px;
|
|
left: 0px;
|
|
width: 100%;
|
|
height: 90%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
animation: 1s spin linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
from {
|
|
transform: rotate(0deg)
|
|
}
|
|
to {
|
|
transform: rotate(360deg)
|
|
}
|
|
}
|
|
</style>
|
|
` |