diff --git a/index.html b/index.html index 7e82e52..d4a3f1e 100644 --- a/index.html +++ b/index.html @@ -8,10 +8,14 @@ +
+ +
+
- +
@@ -20,6 +24,9 @@ +
+ +
diff --git a/player/custom.css b/player/custom.css index effe3db..f9b539b 100644 --- a/player/custom.css +++ b/player/custom.css @@ -17,6 +17,7 @@ html, body { border: solid 1px #aaa; width: 25px; height: 25px; float: right;} .tutorial-player .player-wrapper { + position: relative; width: 100%; height: calc(100% - 33px); } .tutorial-player .player-wrapper .video-title { width: 80%; @@ -26,3 +27,16 @@ html, body { text-align: center; background: rgba(0,0,0,0.5); margin: 0 auto;} + .tutorial-player .player-wrapper .seekbar { + width: calc(100% - 65px); height: 5px; + background-color: #ddd; cursor: pointer; + border-radius: 3px; + margin: 0 auto; + position: relative; + bottom: 30px; } + .tutorial-player .player-wrapper .seekbar .seekbar-pos { + position: absolute; left: calc(0% - 7px); top: -5px; + width: 15px; height: 15px; + border-radius: 50%; + background-color: white; } + diff --git a/player/custom.js b/player/custom.js index 3b369d8..b0d0489 100644 --- a/player/custom.js +++ b/player/custom.js @@ -194,12 +194,52 @@ class TutorialList { } } +class Seekbar { + + constructor() { + this.UI = document.getElementById("seekbar"); + this.posUI = document.getElementById("seekbar_pos"); + this.UI.ontimeupdate = function () { + var percentage = (vid.currentTime / vid.duration) * 100; + $("#custom-seekbar span").css("width", percentage + "%"); + }; + + this.drag_started = false; + + this.posUI.onmousedown = (e) => { + console.log('onmousedown...'); + this.drag_started = true; + }; + this.UI.onmousemove = (e) => { + if (this.drag_started) { + console.log('onmousemove...'); + this.posUI.style.left = e.pageX; + } + }; + this.UI.onmouseup = (e) => { + console.log('onmouseup...'); + this.drag_started = false; + }; + this.posUI.onmouseup = (e) => { + console.log('onmouseup...'); + this.drag_started = false; + }; + } + + + bindEvents = (evName, callback) => { + this.UI.addEventListener(evName, callback) + this.UI[evName] = callback + } + +}; document.ready(async (event) => { const tutorialList = new TutorialList() const player = new Player() + await tutorialList.load() tutorialList.bindEvents('change', (e) => {