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.showControls();
example_media.addCue(3, showTime,
example_media);
example_media.addCue(5, showTime,
example_media);
example_media.addCue(8, showTime,
example_media);
example_media.addCue(10, showTime,
example_media);
}
function
showTime(media) {
r = random(255);
g = random(255);
b = random(255);
background(r, g, b);
let mediaTime = media.time();
text(
"The current time of the video is: "
+
mediaTime, 20, 340);
text(
"The events in addCue() are called "
+
"according to the given time"
, 20, 20);
}