📑 Creates a video element.
Note that videos must be muted to autoplay and the play and pause functions can only be run after a user interaction.
play
pause
The video element can be hidden and its content can be displayed on the canvas using the image function.
image
url of the video
a new video element
await Canvas(1);let vid = createVideo('/assets/apollo4.mp4');vid.size(200, 150);vid.autoplay = vid.muted = vid.loop = true;vid.controls = true; Copy
await Canvas(1);let vid = createVideo('/assets/apollo4.mp4');vid.size(200, 150);vid.autoplay = vid.muted = vid.loop = true;vid.controls = true;
await Canvas(200, 150);let vid = createVideo('/assets/apollo4.mp4');vid.hide();q5.mousePressed = function () { vid.currentTime = 0; vid.play();};q5.draw = function () { rotate(mouseX / 55); image(vid, -100, -75, 200, 150);}; Copy
await Canvas(200, 150);let vid = createVideo('/assets/apollo4.mp4');vid.hide();q5.mousePressed = function () { vid.currentTime = 0; vid.play();};q5.draw = function () { rotate(mouseX / 55); image(vid, -100, -75, 200, 150);};
📑 Creates a video element.
Note that videos must be muted to autoplay and the
playandpausefunctions can only be run after a user interaction.The video element can be hidden and its content can be displayed on the canvas using the
imagefunction.