function
setup() {
createCanvas(550, 400);
textSize(18);
text(
"The events in addCue() are "
+
"called according to the given time"
,
20, 20);
example_media =
createVideo(
"sample-video.mp4"
);
example_media.size(426, 240);
example_media.position(20, 60);
example_media.speed(1.5);
example_media.showControls();
rmvBtn =
createButton(
"Remove All Cues"
);
rmvBtn.position(20, 320);
rmvBtn.mousePressed(removeCues)
example_media.addCue(3, changeColor);
example_media.addCue(4, changeColor);
example_media.addCue(5, changeColor);
example_media.addCue(7, changeColor);
}
function
removeCues() {
clear();
example_media.clearCues();
text(
"All cues removed!"
, 20, 360);
text(
"The clearCues() method removes "
+
"all the current cues"
, 20, 20);
}
function
changeColor() {
r = random(100, 200);
g = random(100, 200);
b = random(100, 200);
background(r, g, b);
text(
"Background Color Changed!"
,
20, 360);
text(
"The events in addCue() are "
+
"called according to the given time"
,
20, 20);
}