-
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.
- Loading branch information
1 parent
94b3c6d
commit 3563e35
Showing
2 changed files
with
51 additions
and
50 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,36 +1,27 @@ | ||
let params = Object.fromEntries(new URLSearchParams(location.search).entries()); | ||
|
||
let { src, poster } = params; | ||
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 autoplay = params.autoplay || 0; | ||
let controls = params.controls || 1; | ||
let loop = params.loop || 0; | ||
let player = new Plyr("video", { controls: "" }); | ||
window.player = player; | ||
|
||
let attr = ""; | ||
let options = {}; | ||
// -------------------------- | ||
|
||
if (controls == 0) { | ||
options = { controls: "" }; | ||
} else { | ||
attr += "controls "; | ||
} | ||
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> | ||
`; | ||
|
||
if (autoplay == 1) { | ||
attr += "autoplay muted "; | ||
options = { controls: "" }; | ||
} | ||
document.querySelector('video').removeEventListener('ended', loadnormal); | ||
|
||
if (loop == 1) { | ||
attr += "loop"; | ||
let player = new Plyr("video", { controls: "" }); | ||
window.player = player; | ||
} | ||
|
||
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; | ||
document.querySelector('video').addEventListener('ended', loadnormal); |
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,24 +1,34 @@ | ||
<!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> | ||
|
||
<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> | ||
<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> |