-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
50 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,36 @@ | ||
document.querySelector(".container").innerHTML = ` | ||
<video crossorigin="anonymous" playsinline autoplay muted> | ||
<source src="https://cdn.nguard.dev/assets/common/video/whistle.mp4" type="video/mp4" size="1080"> | ||
<a href="https://cdn.nguard.dev/assets/common/video/whistle.mp4" download>Download</a> | ||
</video> | ||
`; | ||
let params = Object.fromEntries(new URLSearchParams(location.search).entries()); | ||
|
||
let player = new Plyr("video", { controls: "" }); | ||
window.player = player; | ||
let { src, poster } = params; | ||
|
||
// -------------------------- | ||
let autoplay = params.autoplay || 0; | ||
let controls = params.controls || 1; | ||
let loop = params.loop || 0; | ||
|
||
function loadnormal() { | ||
document.querySelector(".container").innerHTML = ` | ||
<video crossorigin="anonymous" playsinline autoplay muted loop> | ||
<source src="https://cdn.nguard.dev/assets/common/video/background_video.mp4" type="video/mp4" size="1080"> | ||
<a href="https://cdn.nguard.dev/assets/common/video/background_video.mp4" download>Download</a> | ||
</video> | ||
`; | ||
let attr = ""; | ||
let options = {}; | ||
|
||
document.querySelector('video').removeEventListener('ended', loadnormal); | ||
if (controls == 0) { | ||
options = { controls: "" }; | ||
} else { | ||
attr += "controls "; | ||
} | ||
|
||
if (autoplay == 1) { | ||
attr += "autoplay muted "; | ||
options = { controls: "" }; | ||
} | ||
|
||
let player = new Plyr("video", { controls: "" }); | ||
window.player = player; | ||
if (loop == 1) { | ||
attr += "loop"; | ||
} | ||
|
||
document.querySelector('video').addEventListener('ended', loadnormal); | ||
document.querySelector(".container").innerHTML = ` | ||
<video crossorigin="anonymous" playsinline poster="${poster}" ${attr}> | ||
<source src="${src}" type="video/mp4" size="1080"> | ||
<a href="${src}" download>Download</a> | ||
</video> | ||
`; | ||
|
||
const player = new Plyr("video", options); | ||
window.player = player; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Plyr Video Player</title> | ||
<style> | ||
body { padding: 0; margin: 0; overflow: hidden; } | ||
.plyr { height: 100vh !important; } | ||
video { object-fit: cover; } | ||
</style> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdnjs.cloudflare.com/ajax/libs/plyr/3.7.2/plyr.min.css" | ||
/> | ||
</head> | ||
<body> | ||
<div class="container"></div> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Plyr Video Player</title> | ||
<style> | ||
body { | ||
padding: 0; | ||
margin: 0; | ||
overflow: hidden; | ||
} | ||
|
||
.plyr { | ||
height: 100vh !important; | ||
} | ||
|
||
video { | ||
object-fit: cover; | ||
} | ||
</style> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/plyr/3.7.2/plyr.min.css" /> | ||
</head> | ||
|
||
<body> | ||
<div class="container"></div> | ||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/plyr/3.7.2/plyr.min.js"></script> | ||
<script src="../assets/js/plyr/init.js"></script> | ||
</body> | ||
|
||
</html> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/plyr/3.7.2/plyr.min.js"></script> | ||
<script src="../assets/js/plyr/init.js"></script> | ||
</body> | ||
</html> |