diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 20:41:34 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 20:41:34 +0200 |
| commit | 34df2ca203ea934537edb490b8cb632cee650f65 (patch) | |
| tree | 1e05e2758c1c41abd13a82e62ff509d93a208173 /app/client/live/player.js | |
| parent | f9ad8a4c20554bafaa5961ff44af0cec3f65fdb0 (diff) | |
send as png
Diffstat (limited to 'app/client/live/player.js')
| -rw-r--r-- | app/client/live/player.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/client/live/player.js b/app/client/live/player.js index d4831e2..3fd33e8 100644 --- a/app/client/live/player.js +++ b/app/client/live/player.js @@ -1,12 +1,19 @@ import { store } from '../store' import Whammy from './whammy' import types from '../types' -import pix2wav from '../audio/pix2wav' +import * as pix2wav from '../audio/pix2wav' let fps = 0, last_frame -let recording = false, saving = false +let recording = false, saving = false, synthesizing = false let videoWriter +export function startSynthesizing(){ + synthesizing = true +} +export function stopSynthesizing(){ + synthesizing = false +} + export function startRecording(){ videoWriter = new Whammy.Video(10) recording = true @@ -46,6 +53,10 @@ export function onFrame (data) { URL.revokeObjectURL(url) const ctx = canvas.getContext('2d-lodpi') ctx.drawImage(img, 0, 0, canvas.width, canvas.height) + if (synthesizing) { + const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height) + pix2wav.play({ imageData }) + } if (recording) { console.log('record frame') videoWriter.add(canvas) |
