let y = 0;
function
setup() {
createCanvas(550, 450);
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 Cue"
);
rmvBtn.position(20, 320);
rmvBtn.mousePressed(removeCues)
id1 = example_media.addCue(2, showCueNo, 1);
id2 = example_media.addCue(4, showCueNo, 2);
id3 = example_media.addCue(6, showCueNo, 3);
id4 = example_media.addCue(8, showCueNo, 4);
}
function
removeCues() {
clear();
example_media.removeCue(id1);
example_media.removeCue(id3);
text(
"Given cues removed using the "
+
"removeCue() method"
, 20, 20);
y = 0;
}
function
showCueNo(cue_no) {
text(
"This is cue number: "
+ cue_no,
20, y + 360);
y = y + 20;
}