function
setup() {
createCanvas(500, 400);
textSize(20);
text(
"Click on the buttons to slow "
+
"or speed up the video"
, 20, 20);
example_media =
createVideo(
"sample-video.mp4"
);
example_media.size(500, 300);
example_media.position(20, 100);
example_media.showControls();
slowBtn =
createButton(
"Slow Down Video"
);
slowBtn.position(30, 40);
slowBtn.mousePressed(slowVideo);
fastBtn =
createButton(
"Speed Up Video"
);
fastBtn.position(160, 40);
fastBtn.mousePressed(speedVideo);
text(
"The video is playing at normal speed"
,
20, 80);
}
function
slowVideo() {
clear();
example_media.speed(0.3);
text(
"The video is now slowed down"
,
20, 80);
text(
"Click on the buttons to slow "
+
"or speed up the video"
, 20, 20);
}
function
speedVideo() {
clear();
example_media.speed(2.0);
text(
"The video is now speed up"
,
20, 80);
text(
"Click on the buttons to slow "
+
"or speed up the video"
, 20, 20);
}