removed controls and keyboard control of youtube iframe, implemented 'm'm for mute
This commit is contained in:
@@ -1,10 +1,14 @@
|
|||||||
- [x] unmute the player on each module change?
|
- [x] unmute the player on each module change?
|
||||||
- [ ] bug: when you go backwards on the YouTube timeline, it doesn't update the selected module
|
- [x] ` for pause/unpause
|
||||||
(forwards is fine)
|
- [x] `m` for mute/unmute
|
||||||
- [ ] related bug: when you go 5/30 seconds back to an earlier module, it doesn't switch to highlighting
|
- [ ] add a 'muted' indicator outside the iframe
|
||||||
|
- [ ] bug: when you go 5/30 seconds back to an earlier module, it doesn't switch to highlighting
|
||||||
that module (forwards is fine)
|
that module (forwards is fine)
|
||||||
- [ ] ` for pause/unpause
|
- [ ] resolve the 'flashing'/re-rendering of the progress bars
|
||||||
- [ ] `m` for mute/unmute
|
- [ ] hide the progress bar until maybe "unmute"?
|
||||||
|
- [x] remove controls, since we want to be nonlinear
|
||||||
|
- [ ] don't let the YouTube iframe take control of keyboard events
|
||||||
|
- [ ] make it unclickable if possible
|
||||||
- [ ] possible to "hide" iframes that have already been loaded and "show" them on selection?
|
- [ ] possible to "hide" iframes that have already been loaded and "show" them on selection?
|
||||||
- [ ] if so, can you load all the iframes in the background on first page load?
|
- [ ] if so, can you load all the iframes in the background on first page load?
|
||||||
- [ ] remove unused code now that we're totally modular
|
- [ ] remove unused code now that we're totally modular
|
||||||
@@ -16,7 +20,6 @@
|
|||||||
- [ ] (depends on above) enable search
|
- [ ] (depends on above) enable search
|
||||||
- [ ] add checkboxes for 'want to watch'
|
- [ ] add checkboxes for 'want to watch'
|
||||||
- [ ] gray out watched modules
|
- [ ] gray out watched modules
|
||||||
- [ ] resolve the 'flashing'/re-rendering of the progress bars
|
|
||||||
- [ ] related to above: don't re-render the progress bar to "done" or "empty" in current module
|
- [ ] related to above: don't re-render the progress bar to "done" or "empty" in current module
|
||||||
right before switch
|
right before switch
|
||||||
- [ ] make it work decently for mobile!
|
- [ ] make it work decently for mobile!
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import Modules from './Modules.svelte'
|
import Modules from './Modules.svelte'
|
||||||
import YouTube from './YouTube.svelte'
|
import YouTube from './YouTube.svelte'
|
||||||
import { position, currentModule, uid } from './stores'
|
import { position, currentModule, uid, muted } from './stores'
|
||||||
import { getModule } from './utils'
|
import { getModule } from './utils'
|
||||||
import modules from './data'
|
import modules from './data'
|
||||||
|
|
||||||
@@ -15,7 +15,11 @@
|
|||||||
if (pos == null) return
|
if (pos == null) return
|
||||||
const newModule = getModule(pos, $currentModule)
|
const newModule = getModule(pos, $currentModule)
|
||||||
|
|
||||||
if (video.muted()) video.unMute()
|
if ($muted && !video.muted()) {
|
||||||
|
video.mute()
|
||||||
|
} else if (!$muted && video.muted()) {
|
||||||
|
video.unMute()
|
||||||
|
}
|
||||||
position.update(() => pos)
|
position.update(() => pos)
|
||||||
if ((newModule && !$currentModule) || (newModule && $currentModule && newModule.id !==
|
if ((newModule && !$currentModule) || (newModule && $currentModule && newModule.id !==
|
||||||
$currentModule.id)) {
|
$currentModule.id)) {
|
||||||
@@ -64,6 +68,7 @@
|
|||||||
const { key, code, ctrlKey, shiftKey, altKey, metaKey } = e
|
const { key, code, ctrlKey, shiftKey, altKey, metaKey } = e
|
||||||
|
|
||||||
if (shiftKey || altKey || metaKey) return
|
if (shiftKey || altKey || metaKey) return
|
||||||
|
if (!video) return
|
||||||
|
|
||||||
const amount = ctrlKey ? 30 : 5
|
const amount = ctrlKey ? 30 : 5
|
||||||
if (["j", "ArrowDown"].includes(key)) {
|
if (["j", "ArrowDown"].includes(key)) {
|
||||||
@@ -72,7 +77,7 @@
|
|||||||
} else if (["k", "ArrowUp"].includes(key)) {
|
} else if (["k", "ArrowUp"].includes(key)) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
prevModule()
|
prevModule()
|
||||||
} else if ([32, "Space"].includes(code)) {
|
} else if ([32, "Space"].includes(code) || key === "`") {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
toggle(video)
|
toggle(video)
|
||||||
} else if (["l", "ArrowRight"].includes(key)) {
|
} else if (["l", "ArrowRight"].includes(key)) {
|
||||||
@@ -81,6 +86,16 @@
|
|||||||
} else if (["h", "ArrowLeft"].includes(key)) {
|
} else if (["h", "ArrowLeft"].includes(key)) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
jumpTo($position - amount)
|
jumpTo($position - amount)
|
||||||
|
} else if (key === "m") {
|
||||||
|
e.preventDefault()
|
||||||
|
muted.update(m => !m)
|
||||||
|
} else if (key === ";") {
|
||||||
|
e.preventDefault()
|
||||||
|
if (video.paused()) {
|
||||||
|
toggle(video)
|
||||||
|
} else {
|
||||||
|
jumpTo($position - 5)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +126,13 @@
|
|||||||
|
|
||||||
<main>
|
<main>
|
||||||
{#key $currentModule}
|
{#key $currentModule}
|
||||||
<YouTube bind:this={video} videoId={$uid} start={$currentModule.start} end={$currentModule.end}/>
|
<YouTube
|
||||||
|
bind:this={video}
|
||||||
|
videoId={$uid}
|
||||||
|
start={$currentModule.start}
|
||||||
|
end={$currentModule.end}
|
||||||
|
controls={0}
|
||||||
|
/>
|
||||||
{/key}
|
{/key}
|
||||||
<Modules
|
<Modules
|
||||||
on:repositionInModule={onRepositionInModule}
|
on:repositionInModule={onRepositionInModule}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
let divId = `player_${parseInt(Math.random() * 100000).toString()}`
|
let divId = `player_${parseInt(Math.random() * 100000).toString()}`
|
||||||
|
|
||||||
export let videoId; export let height = "390"; export let width = "640"; export let start;
|
export let videoId; export let height = "390"; export let width = "640"; export let start;
|
||||||
export let end;
|
export let end; export let controls = 1;
|
||||||
|
|
||||||
let player;
|
let player;
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
//'onReady': onPlayerReady,
|
//'onReady': onPlayerReady,
|
||||||
onStateChange: onPlayerStateChange
|
onStateChange: onPlayerStateChange
|
||||||
},
|
},
|
||||||
playerVars: { 'autoplay': 1, start, end, mute: 1 },
|
playerVars: { 'autoplay': 1, start, end, mute: 1, controls, disablekb: 1 },
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,7 @@
|
|||||||
export function state() { return player.getPlayerState() }
|
export function state() { return player.getPlayerState() }
|
||||||
export function unMute() { return player.unMute() }
|
export function unMute() { return player.unMute() }
|
||||||
export function muted() { return player.isMuted() }
|
export function muted() { return player.isMuted() }
|
||||||
|
export function mute() { return player.mute() }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span class="yt-component" style="float: left">
|
<span class="yt-component" style="float: left">
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ import modules from './data'
|
|||||||
|
|
||||||
export const currentModule = writable(modules[0])
|
export const currentModule = writable(modules[0])
|
||||||
export const position = writable(0)
|
export const position = writable(0)
|
||||||
|
export const muted = writable(false)
|
||||||
export const uid = derived(currentModule, $currentModule => $currentModule && $currentModule.uid)
|
export const uid = derived(currentModule, $currentModule => $currentModule && $currentModule.uid)
|
||||||
|
|||||||
Reference in New Issue
Block a user