← Back
How to's
How to work with video and sound files
Because Umfeld sits on top of native libraries (FFmpeg for video, PortAudio for sound), it plays media without third-party bindings.
Play a sound
#include "Umfeld.h"
using namespace umfeld;
PAudio* audio;
void setup() {
audio = loadAudio("data/loop.wav");
audio->play();
}
Play a video
PVideo* clip;
void setup() {
clip = loadVideo("data/clip.mp4");
clip->loop();
}
void draw() {
image(clip, 0, 0, width, height);
}
Keep media files in a data/ folder next to your sketch, exactly like Processing.