We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Modifying a sketch that uses mouseX to scrub through a video. Looking to substitute a increasing integer value controlled by a button press.
Button is working and video on the RasPi works well.
This will work but then eventually crash with errors: Gstreamer encountered a general supporting library error GLVideo: qtedemux0: internal data stream error.
import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalInput;
import com.pi4j.io.gpio.PinPullResistance;
import com.pi4j.io.gpio.RaspiPin;
import gohai.glvideo.*;
GLMovie video1;
GpioController gpio;
GpioPinDigitalInput button;
int interval;
void setup() {
size(1500, 800, P2D);
background(0);
interval = 0;
gpio = GpioFactory.getInstance();
button = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);
video1 = new GLMovie(this, "wheel.mp4");
video1.pause();
}
void draw() {
if (button.isHigh()) {
println("pressed");
interval++;
println(interval);
if (video1.available()) {
video1.read();
}
float moviePosition = map(interval, 0, width, 0, video1.duration());
print(mouseX);
video1.jump(moviePosition);
image(video1, 0, 0, width, height);
}
}
Answers
This works, but how to make that scrubbing smooth like mouseX....? hmmmm...