update
This commit is contained in:
parent
398332661e
commit
63edb7268f
8 changed files with 88 additions and 65 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"git.ignoreLimitWarning": true
|
|
||||||
}
|
|
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "plyx-player",
|
"name": "zorn",
|
||||||
"version": "2023.12.14",
|
"version": "2024.02.25",
|
||||||
"description": "Custom player for HTML5",
|
"description": "Custom player for HTML5",
|
||||||
"author": "sudovanilla",
|
"author": "sudovanilla",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://sudovanilla.com/code/Korbs/Plyx-Player/issues",
|
"url": "https://sudovanilla.com/code/Korbs/Zorn/issues",
|
||||||
"email": "support@sduovanilla.com"
|
"email": "support@sduovanilla.com"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
const video = document.querySelector('.plyx-player')
|
const video = document.querySelector('.zorn-player')
|
||||||
const videoContainer = document.querySelector('.video-container')
|
const videoContainer = document.querySelector('.video-container')
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
video.addEventListener('error', function(event) {
|
video.addEventListener('error', function(event) {
|
||||||
document.querySelector('#invalid-src').style.display = 'inherit'
|
document.querySelector('#invalid-src').style.display = 'inherit'
|
||||||
document.querySelector('.plyx-player-controls').style.display = 'none'
|
document.querySelector('.zorn-player-controls').style.display = 'none'
|
||||||
videoContainer.style.backgroundColor = '#101010'
|
videoContainer.style.backgroundColor = '#101010'
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
video.style.opacity = '0.10'
|
video.style.opacity = '0.10'
|
||||||
|
@ -25,11 +25,11 @@ video.oncanplaythrough = (event) => {
|
||||||
|
|
||||||
function AddDialogs() {
|
function AddDialogs() {
|
||||||
var add_dialogs = `
|
var add_dialogs = `
|
||||||
<div class="plyx-player-dialogs">
|
<div class="zorn-player-dialogs">
|
||||||
<div id="buffering" class="plyx-dialog">
|
<div id="buffering" class="zorn-dialog">
|
||||||
<h2><i class="fa-duotone fa-spinner-third fa-spin fa-2xl"></i></h2>
|
<h2><i class="fa-duotone fa-spinner-third fa-spin fa-2xl"></i></h2>
|
||||||
</div>
|
</div>
|
||||||
<div id="invalid-src" class="plyx-dialog">
|
<div id="invalid-src" class="zorn-dialog">
|
||||||
<h2>Failed to Load</h2>
|
<h2>Failed to Load</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -39,15 +39,11 @@ function AddDialogs() {
|
||||||
|
|
||||||
function AddControls() {
|
function AddControls() {
|
||||||
if (video.getAttribute('layout') === 'default') {
|
if (video.getAttribute('layout') === 'default') {
|
||||||
|
var ZornTitleArea = document.querySelector(".video-container > h2")
|
||||||
|
var VideoTitle = video.getAttribute('title')
|
||||||
var add_controls = `
|
var add_controls = `
|
||||||
<div oncontextmenu="return false" class="plyx-player-controls">
|
<h2 class="zorn-title hide"></h2>
|
||||||
<div class="row-2">
|
<div oncontextmenu="return false" class="zorn-player-controls">
|
||||||
<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">
|
||||||
<div class="row-1-start">
|
<div class="row-1-start">
|
||||||
<button id="play-pause"><i class="fa-solid fa-play"></i></button>
|
<button id="play-pause"><i class="fa-solid fa-play"></i></button>
|
||||||
|
@ -58,6 +54,13 @@ function AddControls() {
|
||||||
<input class="volume" id="volume" value="1" type="range" max="1" min="0" step="0.01">
|
<input class="volume" id="volume" value="1" type="range" max="1" min="0" step="0.01">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row-1-center">
|
||||||
|
<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-end">
|
<div class="row-1-end">
|
||||||
<div class="time">
|
<div class="time">
|
||||||
<time id="time-elapsed">00:00</time>
|
<time id="time-elapsed">00:00</time>
|
||||||
|
@ -77,13 +80,19 @@ function AddControls() {
|
||||||
|
|
||||||
|
|
||||||
video.insertAdjacentHTML("afterend", add_controls)
|
video.insertAdjacentHTML("afterend", add_controls)
|
||||||
// video.setAttribute("oncontextmenu", "return false")
|
if (video.hasAttribute('title')) {
|
||||||
|
document.querySelector(".video-container .zorn-title").style.dispaly = 'inherit'
|
||||||
|
document.querySelector(".video-container > h2").innerText = VideoTitle
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
video.setAttribute("oncontextmenu", "return false")
|
||||||
}
|
}
|
||||||
|
|
||||||
function Util() {
|
function Util() {
|
||||||
const videoControls = document.querySelector('.plyx-player-controls')
|
const videoControls = document.querySelector('.zorn-player-controls')
|
||||||
// Subtitles
|
// Subtitles
|
||||||
var subtitles = document.querySelector('.plyx-player-controls #subtitles');
|
var subtitles = document.querySelector('.zorn-player-controls #subtitles');
|
||||||
var subtitleMenuButtons = [];
|
var subtitleMenuButtons = [];
|
||||||
var createMenuItem = function(id, lang, label) {
|
var createMenuItem = function(id, lang, label) {
|
||||||
var listItem = document.createElement('li');
|
var listItem = document.createElement('li');
|
||||||
|
@ -131,7 +140,7 @@ function Util() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Play/Plause
|
// Play/Plause
|
||||||
const Button_PlayPause = document.querySelector('.plyx-player-controls #play-pause')
|
const Button_PlayPause = document.querySelector('.zorn-player-controls #play-pause')
|
||||||
|
|
||||||
Button_PlayPause.addEventListener('click', Toggle_PlayPause)
|
Button_PlayPause.addEventListener('click', Toggle_PlayPause)
|
||||||
video.addEventListener('click', Toggle_PlayPause)
|
video.addEventListener('click', Toggle_PlayPause)
|
||||||
|
@ -180,8 +189,8 @@ function Util() {
|
||||||
videoContainer.addEventListener('fullscreenchange', Update_FullscreenButton)
|
videoContainer.addEventListener('fullscreenchange', Update_FullscreenButton)
|
||||||
|
|
||||||
// Skip Back or Forth
|
// Skip Back or Forth
|
||||||
const Button_SkipBack = document.querySelector('.plyx-player-controls #skip-back')
|
const Button_SkipBack = document.querySelector('.zorn-player-controls #skip-back')
|
||||||
const Button_SkipForth = document.querySelector('.plyx-player-controls #skip-forth')
|
const Button_SkipForth = document.querySelector('.zorn-player-controls #skip-forth')
|
||||||
|
|
||||||
Button_SkipBack.addEventListener('click', Toggle_SkipBack)
|
Button_SkipBack.addEventListener('click', Toggle_SkipBack)
|
||||||
Button_SkipForth.addEventListener('click', Toggle_SkipForth)
|
Button_SkipForth.addEventListener('click', Toggle_SkipForth)
|
||||||
|
@ -290,18 +299,22 @@ function Util() {
|
||||||
|
|
||||||
// Auto Hide Controls
|
// Auto Hide Controls
|
||||||
function Hide_Controls() {
|
function Hide_Controls() {
|
||||||
|
var ZornTitleArea = document.querySelector(".video-container > h2")
|
||||||
if (video.paused) {
|
if (video.paused) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
videoControls.classList.add('hide')
|
videoControls.classList.add('hide')
|
||||||
subtitlesMenu.classList.add('hide')
|
subtitlesMenu.classList.add('hide')
|
||||||
|
ZornTitleArea.classList.add('hide')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show_Controls displays the video controls
|
// Show_Controls displays the video controls
|
||||||
function Show_Controls() {
|
function Show_Controls() {
|
||||||
|
var ZornTitleArea = document.querySelector(".video-container > h2")
|
||||||
videoControls.classList.remove('hide')
|
videoControls.classList.remove('hide')
|
||||||
subtitlesMenu.classList.remove('hide')
|
subtitlesMenu.classList.remove('hide')
|
||||||
|
ZornTitleArea.classList.remove('hide')
|
||||||
}
|
}
|
||||||
video.addEventListener('mouseenter', Show_Controls)
|
video.addEventListener('mouseenter', Show_Controls)
|
||||||
video.addEventListener('mouseleave', Hide_Controls)
|
video.addEventListener('mouseleave', Hide_Controls)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const video = document.querySelector('.plyx-player')
|
const video = document.querySelector('.zorn-player')
|
||||||
|
|
||||||
function VideoLength() {
|
function VideoLength() {
|
||||||
// Duration and Length of Video
|
// Duration and Length of Video
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,13 +7,13 @@ $background-color_3: #fff;
|
||||||
$background-color_4: rgba(255, 255, 255, 0.1);
|
$background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--plyx-progress-bar-bg: rgba(100,100,100,0.5);
|
--zorn-progress-bar-bg: rgba(100,100,100,0.5);
|
||||||
--plyx-progress-bar: rgba(255, 0, 0, 0.5);
|
--zorn-progress-bar: rgba(255, 0, 0, 0.5);
|
||||||
--pylx-thumb: red;
|
--zorn-thumb: red;
|
||||||
--pylx-rounded-corners: 4px;
|
--zorn-rounded-corners: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plyx-context-menu {
|
.zorn-context-menu {
|
||||||
background: linear-gradient( 45deg, rgb(10, 20, 28) 0%, rgba(10, 20, 28, 1) 100% );
|
background: linear-gradient( 45deg, rgb(10, 20, 28) 0%, rgba(10, 20, 28, 1) 100% );
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
border: 1px rgba(255, 255, 255, 0.08) solid;
|
border: 1px rgba(255, 255, 255, 0.08) solid;
|
||||||
|
@ -46,7 +46,7 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-family: $font-family_1;
|
font-family: $font-family_1;
|
||||||
color: $color_1;
|
color: $color_1;
|
||||||
.plyx-player-dialogs {
|
.zorn-player-dialogs {
|
||||||
#buffering {
|
#buffering {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -72,14 +72,25 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.plyx-player {
|
.zorn-player {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
|
.zorn-title {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
background: rgb(17 17 17 / 90%);
|
||||||
|
width: auto;
|
||||||
|
margin: 12px;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
.hide {
|
.hide {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
.plyx-player-title {
|
.zorn-player-title {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -92,7 +103,7 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 60px;
|
right: 60px;
|
||||||
bottom: 80px;
|
bottom: 50px;
|
||||||
background: #0009;
|
background: #0009;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
|
@ -115,13 +126,13 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.plyx-player-controls {
|
.zorn-player-controls {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: -1px;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
background-image: linear-gradient(to bottom, rgba(12, 12, 12, 0), rgba(12, 12, 12, 0.75));
|
background-image: linear-gradient(to bottom, rgba(12, 12, 12, 0), rgba(12, 12, 12, 0.75));
|
||||||
flex-direction: inherit;
|
flex-direction: inherit;
|
||||||
|
@ -129,12 +140,15 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-bottom: 12px;
|
|
||||||
}
|
}
|
||||||
.row-1-start {
|
.row-1-start {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
.row-1-center {
|
||||||
|
display: flex;
|
||||||
|
width: calc(100% - 420px);
|
||||||
|
}
|
||||||
.row-1-end {
|
.row-1-end {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -179,27 +193,25 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 6.4px;
|
height: 6.4px;
|
||||||
margin: 24px 0px;
|
margin: 24px 0px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
progress {
|
progress {
|
||||||
-webkit-appearance: none;
|
border-radius: 1rem;
|
||||||
-moz-appearance: none;
|
|
||||||
appearance: none;
|
|
||||||
border-radius: 2px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 8.4px;
|
height: 8.4px;
|
||||||
pointer-events: none;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
&::-webkit-progress-bar {
|
&::-webkit-progress-bar {
|
||||||
border-radius: 2px;
|
border-radius: 1rem;
|
||||||
|
background: var(--zorn-progress-bar-bg);
|
||||||
}
|
}
|
||||||
&::-webkit-progress-value {
|
&::-webkit-progress-value {
|
||||||
background: transparent;
|
background: var(--zorn-progress-bar);
|
||||||
border-radius: 2px;
|
border-radius: 1rem;
|
||||||
}
|
}
|
||||||
&::-moz-progress-bar {
|
&::-moz-progress-bar {
|
||||||
border: none;
|
border-radius: 1rem;
|
||||||
background: var(--plyx-progress-bar);
|
background: var(--zorn-progress-bar-bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.seek {
|
.seek {
|
||||||
|
@ -218,22 +230,23 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
.seek-tooltip {
|
.seek-tooltip {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: relative;
|
||||||
top: -32px;
|
top: -32px;
|
||||||
margin-left: -30px;
|
margin-left: -230px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding: 3px;
|
|
||||||
content: attr(data-title);
|
content: attr(data-title);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: $color_2;
|
color: #fff;
|
||||||
background-color: $background-color_2;
|
background-color: rgba(0,0,0,.5);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
|
width: fit-content;
|
||||||
}
|
}
|
||||||
input[type=range] {
|
input[type=range] {
|
||||||
height: 8.4px;
|
height: 8.4px;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
opacity: 0;
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
&::-webkit-slider-runnable-track {
|
&::-webkit-slider-runnable-track {
|
||||||
|
@ -254,7 +267,7 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
height: 12px;
|
height: 12px;
|
||||||
width: 12px;
|
width: 12px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background: var(--pylx-thumb);
|
background: var(--zorn-thumb);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
margin-left: -1px;
|
margin-left: -1px;
|
||||||
|
@ -291,7 +304,7 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
width: 12px;
|
width: 12px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border: none;
|
border: none;
|
||||||
background: var(--pylx-thumb);
|
background: var(--zorn-thumb);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,7 +313,7 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
#progress-bar {
|
#progress-bar {
|
||||||
background: var(--plyx-progress-bar-bg);
|
background: var(--zorn-progress-bar-bg);
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Plyx Player</title>
|
<title>Zorn</title>
|
||||||
<link rel="stylesheet" href="/src/styles/app.css">
|
<link rel="stylesheet" href="/src/styles/app.css">
|
||||||
<script src="/src/index.js" type="module"></script>
|
<script src="/src/index.js" type="module"></script>
|
||||||
<script src="/src/icons/fa-kit/js/all.js" crossorigin="anonymous"></script>
|
<script src="/src/icons/fa-kit/js/all.js" crossorigin="anonymous"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>Plyx Player <span>By SudoVanilla</span></p>
|
<p>Zorn <span>By SudoVanilla</span></p>
|
||||||
<div class="video-container">
|
<div class="video-container">
|
||||||
<video class="plyx-player" layout="default">
|
<video class="zorn-player" layout="default">
|
||||||
<!-- Quality changer support has not been worked on yet -->
|
<!-- Quality changer support has not been worked on yet -->
|
||||||
<source label="720p" src="ennie yoyki completo-S50_Iv43y_w.mp4" type="video/mp4">
|
<source label="720p" src="ennie yoyki completo-S50_Iv43y_w.mp4" type="video/mp4">
|
||||||
<source label="480p" src="480.mp4" type="video/mp4">
|
<source label="480p" src="480.mp4" type="video/mp4">
|
||||||
<!-- Caption support has not been worked on yet -->
|
<!-- Caption support has not been worked on yet in custom player -->
|
||||||
<track src="English.vtt" kind="subtitles" srclang="en" label="English">
|
<track src="English.vtt" kind="subtitles" srclang="en" label="English">
|
||||||
<track src="Russian.vtt" kind="subtitles" srclang="ru" label="Russian">
|
<track src="Russian.vtt" kind="subtitles" srclang="ru" label="Russian">
|
||||||
</video>
|
</video>
|
||||||
|
@ -27,10 +27,10 @@
|
||||||
<!-- Change colors in the player -->
|
<!-- Change colors in the player -->
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--plyx-progress-bar-bg: rgba(85, 144, 179, 0.23);
|
--zorn-progress-bar-bg: rgba(85, 144, 179, 0.23);
|
||||||
--plyx-progress-bar:rgb(0, 195, 255);
|
--zorn-progress-bar:rgb(0, 195, 255);
|
||||||
--pylx-thumb: #7997d0;
|
--zorn-thumb: #7997d0;
|
||||||
--pylx-rounded-corners: 4px;
|
--zorn-rounded-corners: 4px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
Reference in a new issue