Toggle navigation
Toggle navigation
This project
Loading...
Sign in
강연욱
/
myYoutube
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
2
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Flare-k
2020-06-19 04:17:11 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d3be3691c624b0c51b2eff832fcf3161f0d03b8c
d3be3691
1 parent
8b91895a
[Modified] Screen
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
4 deletions
assets/js/videoPlayer.js
static/main.js
views/mixins/videoPlayer.pug
assets/js/videoPlayer.js
View file @
d3be369
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 읽히므로..
...
...
static/main.js
View file @
d3be369
...
...
@@ -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?"
);
/***/
}),
...
...
views/mixins/videoPlayer.pug
View file @
d3be369
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
...
...
Please
register
or
login
to post a comment