Flare-k

[Modified] Screen

const videoContainer = document.getElementById("jsVideoPlayer");
const videoPlayer = document.querySelector("#jsVideoPlayer video");
const playBtn = document.getElementById("jsPlayButton");
const volumeBtn = document.getElementById("jsVolumeBtn");
// video element MDN
// using MDN (Mozila Developer Networks)
function handlePlayClick() {
if (videoPlayer.paused) {
videoPlayer.play();
playBtn.innerHTML = '<i class="fas fa-pause"></i>';
} else {
videoPlayer.pause();
playBtn.innerHTML = '<i class="fas fa-play"></i>';
}
}
function handleVolumeClick() {
if (videoPlayer.muted) {
videoPlayer.muted = false;
volumeBtn.innerHTML = '<i class="fas fa-volume-up"></i>';
} else {
videoPlayer.muted = true;
volumeBtn.innerHTML = '<i class="fas fa-volume-mute"></i>';
}
}
function init() {
playBtn.addEventListener("click", handlePlayClick);
volumeBtn.addEventListener("click", handleVolumeClick);
}
if (videoContainer) {
init();
} // 안 해주면 다른 페이지에서도 js 읽히므로..
......
......@@ -105,7 +105,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _scs
/*! no static exports found */
/***/ (function(module, exports) {
eval("\n\n//# sourceURL=webpack:///./assets/js/videoPlayer.js?");
eval("const videoContainer = document.getElementById(\"jsVideoPlayer\");\nconst videoPlayer = document.querySelector(\"#jsVideoPlayer video\");\nconst playBtn = document.getElementById(\"jsPlayButton\");\nconst volumeBtn = document.getElementById(\"jsVolumeBtn\");\n\n// video element MDN\n// using MDN (Mozila Developer Networks)\nfunction handlePlayClick() {\n if (videoPlayer.paused) {\n videoPlayer.play();\n playBtn.innerHTML = '<i class=\"fas fa-pause\"></i>';\n } else {\n videoPlayer.pause();\n playBtn.innerHTML = '<i class=\"fas fa-play\"></i>';\n }\n}\nfunction handleVolumeClick() {\n if (videoPlayer.muted) {\n videoPlayer.muted = false;\n volumeBtn.innerHTML = '<i class=\"fas fa-volume-up\"></i>';\n } else {\n videoPlayer.muted = true;\n volumeBtn.innerHTML = '<i class=\"fas fa-volume-mute\"></i>';\n }\n}\nfunction init() {\n playBtn.addEventListener(\"click\", handlePlayClick);\n volumeBtn.addEventListener(\"click\", handleVolumeClick);\n}\n\nif (videoContainer) {\n init();\n} // 안 해주면 다른 페이지에서도 js 읽히므로..\n\n\n//# sourceURL=webpack:///./assets/js/videoPlayer.js?");
/***/ }),
......
mixin videoPlayer(video={})
.videoPlayer
.videoPlayer#jsVideoPlayer
video(src=`/${video.src}`)
.videoPlayer__controls
.videoPlayer__column
span
span#jsVolumeBtn
i.fas.fa-volume-up
span
|00:00 / 10:00
.videoPlayer__column
span
span#jsPlayButton
i.fas.fa-play
.videoPlayer__column
span
......