diff options
Diffstat (limited to 'app/client/live/player.js')
| -rw-r--r-- | app/client/live/player.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/client/live/player.js b/app/client/live/player.js index 483bbf1..78f5c24 100644 --- a/app/client/live/player.js +++ b/app/client/live/player.js @@ -3,7 +3,7 @@ import Whammy from './whammy' import types from '../types' import * as pix2wav from '../audio/pix2wav' -let fps = 0, last_frame +let fps = 0 let recording = false, saving = false, synthesizing = false let videoWriter @@ -42,6 +42,10 @@ export function saveFrame(){ } export function onFrame (data) { + store.dispatch({ + type: types.player.current_frame, + meta: data.meta, + }) const blob = new Blob([data.frame], { type: 'image/jpg' }) const url = URL.createObjectURL(blob) const img = new Image () @@ -49,7 +53,6 @@ export function onFrame (data) { if (! canvas) return console.error('no canvas for frame') img.onload = () => { img.onload = null - last_frame = data.meta URL.revokeObjectURL(url) const ctx = canvas.getContext('2d-lodpi') ctx.drawImage(img, 0, 0, canvas.width, canvas.height) @@ -100,10 +103,6 @@ export function startWatchingFPS(){ type: types.player.set_fps, fps: fps, }) - store.dispatch({ - type: types.player.current_frame, - meta: last_frame, - }) fps = 0 }, 1000) } |
