OAVp5.record.state#
variableoav-p5OAVp5.record.state
Where the recording is: 'off', 'starting', 'on' or 'saving'.
recordingIsOn is state === 'on'. Read the state when the other stages matter: a button can show "starting…" and "saving…" and refuse a new take while one is being saved.
- Type
String- Range
off | starting | on | saving
Starts as 'off'. A take goes 'starting' (the recorder is loading, the first time), 'on' (recording), 'saving' (the file is being made) and back to 'off'.
Examples
function setup() {
createCanvas(400, 300);
textAlign(CENTER, CENTER);
textSize(28);
}
function keyPressed() {
if (key === 'r' && OAVp5.record.state === 'off') startRecording(3);
}
function draw() {
background(20);
circle(200 + sin(frameCount * 0.05) * 120, 220, 40);
fill(255);
text(OAVp5.record.state === 'off' ? 'press r' : OAVp5.record.state, width / 2, 70);
}Related
recordingIsOnWhether a recording is running right now.startRecording()Records the canvas and the sound your sketch makes into one video file, and returns a promise that says whether the recording began.stopRecording()Stops the recording; the video is finished, downloaded, and handed torecordingSaved(info)and to the returned promise.OAVp5.recordThe object behind the recording names: the state, the time, the last file, the formats this browser can write and the screenshot function.