silly bugy

This commit is contained in:
2020-10-04 16:31:20 +02:00
parent 123d55717c
commit b0c7aa402b
5 changed files with 9 additions and 3 deletions

View File

@@ -17,3 +17,7 @@
- [x] either don't allow going before the first module, or fix it so that the first module isn't highlighted when watching the pre-module content (first solution is easier)
- [x] add "flat" drop shadow to progress bar and modules
- [ ] add a diagonally oriented aqua triangle at the upper right, as the logo
- [ ] bug: when the newly seleted module is from a different YouTube UID, it doesn't autoplay and it
doesn't advance
- [ ] bug: when you go backwards on the YouTube timeline, it doesn't update the selected module
(forwards is fine)

View File

@@ -14,6 +14,7 @@
const positionUpdater = () => {
interval = setInterval(() => {
const pos = video.position()
if (pos == null) return
const newModule = getModule(pos, $currentModule)
position.update(() => pos)
if ((newModule && !$currentModule) || (newModule && $currentModule && newModule.id !==

View File

@@ -9,8 +9,8 @@
const getProgress = pos => (pos - module.start) / module.duration * 100
let selected; let progress; let klass; let progressBar
$: selected = $currentModule && $currentModule.id === module.id
$: if (selected) {
progress = getProgress($position)
klass = "current"

View File

@@ -62,9 +62,9 @@
return false;
}
export function position() { return player.getCurrentTime() }
export function position() { if (player.getCurrentTime) return player.getCurrentTime() }
export function play() { player.playVideo() }
export function jumpTo(seconds) { player.seekTo(seconds) }
export function jumpTo(seconds) { if (player.seekTo) player.seekTo(seconds) }
export function pause() { player.pauseVideo() }
export function paused() { return [5, 2, -1].includes(player.getPlayerState()) }
export function buffering() { return player.getPlayerState() === 3 }

View File

@@ -1,6 +1,7 @@
import { modules } from './data'
export const getModule = (position, currentModule) => {
if (!currentModule) return modules[0]
if (position < currentModule.end) {
return currentModule
}