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",
|
||||
"version": "2023.12.14",
|
||||
"name": "zorn",
|
||||
"version": "2024.02.25",
|
||||
"description": "Custom player for HTML5",
|
||||
"author": "sudovanilla",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://sudovanilla.com/code/Korbs/Plyx-Player/issues",
|
||||
"url": "https://sudovanilla.com/code/Korbs/Zorn/issues",
|
||||
"email": "support@sduovanilla.com"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const video = document.querySelector('.plyx-player')
|
||||
const video = document.querySelector('.zorn-player')
|
||||
const videoContainer = document.querySelector('.video-container')
|
||||
|
||||
// Events
|
||||
video.addEventListener('error', function(event) {
|
||||
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'
|
||||
setTimeout(() => {
|
||||
video.style.opacity = '0.10'
|
||||
|
@ -25,11 +25,11 @@ video.oncanplaythrough = (event) => {
|
|||
|
||||
function AddDialogs() {
|
||||
var add_dialogs = `
|
||||
<div class="plyx-player-dialogs">
|
||||
<div id="buffering" class="plyx-dialog">
|
||||
<div class="zorn-player-dialogs">
|
||||
<div id="buffering" class="zorn-dialog">
|
||||
<h2><i class="fa-duotone fa-spinner-third fa-spin fa-2xl"></i></h2>
|
||||
</div>
|
||||
<div id="invalid-src" class="plyx-dialog">
|
||||
<div id="invalid-src" class="zorn-dialog">
|
||||
<h2>Failed to Load</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -39,15 +39,11 @@ function AddDialogs() {
|
|||
|
||||
function AddControls() {
|
||||
if (video.getAttribute('layout') === 'default') {
|
||||
var ZornTitleArea = document.querySelector(".video-container > h2")
|
||||
var VideoTitle = video.getAttribute('title')
|
||||
var add_controls = `
|
||||
<div oncontextmenu="return false" class="plyx-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>
|
||||
<h2 class="zorn-title hide"></h2>
|
||||
<div oncontextmenu="return false" class="zorn-player-controls">
|
||||
<div class="row-1">
|
||||
<div class="row-1-start">
|
||||
<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">
|
||||
</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="time">
|
||||
<time id="time-elapsed">00:00</time>
|
||||
|
@ -77,13 +80,19 @@ function AddControls() {
|
|||
|
||||
|
||||
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() {
|
||||
const videoControls = document.querySelector('.plyx-player-controls')
|
||||
const videoControls = document.querySelector('.zorn-player-controls')
|
||||
// Subtitles
|
||||
var subtitles = document.querySelector('.plyx-player-controls #subtitles');
|
||||
var subtitles = document.querySelector('.zorn-player-controls #subtitles');
|
||||
var subtitleMenuButtons = [];
|
||||
var createMenuItem = function(id, lang, label) {
|
||||
var listItem = document.createElement('li');
|
||||
|
@ -131,7 +140,7 @@ function Util() {
|
|||
});
|
||||
|
||||
// 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)
|
||||
video.addEventListener('click', Toggle_PlayPause)
|
||||
|
@ -180,8 +189,8 @@ function Util() {
|
|||
videoContainer.addEventListener('fullscreenchange', Update_FullscreenButton)
|
||||
|
||||
// Skip Back or Forth
|
||||
const Button_SkipBack = document.querySelector('.plyx-player-controls #skip-back')
|
||||
const Button_SkipForth = document.querySelector('.plyx-player-controls #skip-forth')
|
||||
const Button_SkipBack = document.querySelector('.zorn-player-controls #skip-back')
|
||||
const Button_SkipForth = document.querySelector('.zorn-player-controls #skip-forth')
|
||||
|
||||
Button_SkipBack.addEventListener('click', Toggle_SkipBack)
|
||||
Button_SkipForth.addEventListener('click', Toggle_SkipForth)
|
||||
|
@ -290,18 +299,22 @@ function Util() {
|
|||
|
||||
// Auto Hide Controls
|
||||
function Hide_Controls() {
|
||||
var ZornTitleArea = document.querySelector(".video-container > h2")
|
||||
if (video.paused) {
|
||||
return
|
||||
}
|
||||
|
||||
videoControls.classList.add('hide')
|
||||
subtitlesMenu.classList.add('hide')
|
||||
ZornTitleArea.classList.add('hide')
|
||||
}
|
||||
|
||||
// Show_Controls displays the video controls
|
||||
function Show_Controls() {
|
||||
var ZornTitleArea = document.querySelector(".video-container > h2")
|
||||
videoControls.classList.remove('hide')
|
||||
subtitlesMenu.classList.remove('hide')
|
||||
ZornTitleArea.classList.remove('hide')
|
||||
}
|
||||
video.addEventListener('mouseenter', Show_Controls)
|
||||
video.addEventListener('mouseleave', Hide_Controls)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const video = document.querySelector('.plyx-player')
|
||||
const video = document.querySelector('.zorn-player')
|
||||
|
||||
function VideoLength() {
|
||||
// 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);
|
||||
|
||||
:root {
|
||||
--plyx-progress-bar-bg: rgba(100,100,100,0.5);
|
||||
--plyx-progress-bar: rgba(255, 0, 0, 0.5);
|
||||
--pylx-thumb: red;
|
||||
--pylx-rounded-corners: 4px;
|
||||
--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;
|
||||
}
|
||||
|
||||
.plyx-context-menu {
|
||||
.zorn-context-menu {
|
||||
background: linear-gradient( 45deg, rgb(10, 20, 28) 0%, rgba(10, 20, 28, 1) 100% );
|
||||
border-radius: 6px;
|
||||
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;
|
||||
font-family: $font-family_1;
|
||||
color: $color_1;
|
||||
.plyx-player-dialogs {
|
||||
.zorn-player-dialogs {
|
||||
#buffering {
|
||||
display: none;
|
||||
position: absolute;
|
||||
|
@ -72,14 +72,25 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
|||
}
|
||||
}
|
||||
}
|
||||
.plyx-player {
|
||||
.zorn-player {
|
||||
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 {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
.plyx-player-title {
|
||||
.zorn-player-title {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
|
@ -92,7 +103,7 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
|||
display: none;
|
||||
position: absolute;
|
||||
right: 60px;
|
||||
bottom: 80px;
|
||||
bottom: 50px;
|
||||
background: #0009;
|
||||
list-style: none;
|
||||
padding: 6px;
|
||||
|
@ -115,13 +126,13 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
|||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
.plyx-player-controls {
|
||||
.zorn-player-controls {
|
||||
display: inline-flex;
|
||||
right: 0;
|
||||
left: 0;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
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;
|
||||
|
@ -129,12 +140,15 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
|||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
.row-1-start {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.row-1-center {
|
||||
display: flex;
|
||||
width: calc(100% - 420px);
|
||||
}
|
||||
.row-1-end {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -179,27 +193,25 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
|||
position: relative;
|
||||
height: 6.4px;
|
||||
margin: 24px 0px;
|
||||
width: 100%;
|
||||
}
|
||||
progress {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
border-radius: 2px;
|
||||
border-radius: 1rem;
|
||||
width: 100%;
|
||||
height: 8.4px;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
&::-webkit-progress-bar {
|
||||
border-radius: 2px;
|
||||
border-radius: 1rem;
|
||||
background: var(--zorn-progress-bar-bg);
|
||||
}
|
||||
&::-webkit-progress-value {
|
||||
background: transparent;
|
||||
border-radius: 2px;
|
||||
background: var(--zorn-progress-bar);
|
||||
border-radius: 1rem;
|
||||
}
|
||||
&::-moz-progress-bar {
|
||||
border: none;
|
||||
background: var(--plyx-progress-bar);
|
||||
border-radius: 1rem;
|
||||
background: var(--zorn-progress-bar-bg);
|
||||
}
|
||||
}
|
||||
.seek {
|
||||
|
@ -218,22 +230,23 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
|||
}
|
||||
.seek-tooltip {
|
||||
display: none;
|
||||
position: absolute;
|
||||
position: relative;
|
||||
top: -32px;
|
||||
margin-left: -30px;
|
||||
margin-left: -230px;
|
||||
font-size: 12px;
|
||||
padding: 3px;
|
||||
content: attr(data-title);
|
||||
font-weight: bold;
|
||||
color: $color_2;
|
||||
background-color: $background-color_2;
|
||||
color: #fff;
|
||||
background-color: rgba(0,0,0,.5);
|
||||
border-radius: 4px;
|
||||
padding: 6px;
|
||||
width: fit-content;
|
||||
}
|
||||
input[type=range] {
|
||||
height: 8.4px;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
&:focus {
|
||||
outline: none;
|
||||
&::-webkit-slider-runnable-track {
|
||||
|
@ -254,7 +267,7 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
|||
height: 12px;
|
||||
width: 12px;
|
||||
border-radius: 10px;
|
||||
background: var(--pylx-thumb);
|
||||
background: var(--zorn-thumb);
|
||||
cursor: pointer;
|
||||
-webkit-appearance: none;
|
||||
margin-left: -1px;
|
||||
|
@ -291,7 +304,7 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
|||
width: 12px;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
background: var(--pylx-thumb);
|
||||
background: var(--zorn-thumb);
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +313,7 @@ $background-color_4: rgba(255, 255, 255, 0.1);
|
|||
pointer-events: none;
|
||||
}
|
||||
#progress-bar {
|
||||
background: var(--plyx-progress-bar-bg);
|
||||
background: var(--zorn-progress-bar-bg);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Plyx Player</title>
|
||||
<title>Zorn</title>
|
||||
<link rel="stylesheet" href="/src/styles/app.css">
|
||||
<script src="/src/index.js" type="module"></script>
|
||||
<script src="/src/icons/fa-kit/js/all.js" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>Plyx Player <span>By SudoVanilla</span></p>
|
||||
<p>Zorn <span>By SudoVanilla</span></p>
|
||||
<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 -->
|
||||
<source label="720p" src="ennie yoyki completo-S50_Iv43y_w.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="Russian.vtt" kind="subtitles" srclang="ru" label="Russian">
|
||||
</video>
|
||||
|
@ -27,10 +27,10 @@
|
|||
<!-- Change colors in the player -->
|
||||
<style>
|
||||
:root {
|
||||
--plyx-progress-bar-bg: rgba(85, 144, 179, 0.23);
|
||||
--plyx-progress-bar:rgb(0, 195, 255);
|
||||
--pylx-thumb: #7997d0;
|
||||
--pylx-rounded-corners: 4px;
|
||||
--zorn-progress-bar-bg: rgba(85, 144, 179, 0.23);
|
||||
--zorn-progress-bar:rgb(0, 195, 255);
|
||||
--zorn-thumb: #7997d0;
|
||||
--zorn-rounded-corners: 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
Reference in a new issue