//video play pause
var playing = false;
var fingers;
var button;
var col;
function setup() {
var myCanvas = createCanvas(320, 250);
myCanvas.parent('myContainer');
fingers = createVideo(['asset/m1.mp4','asset/m1.webm']);
background(0);
fingers.position(0, 0);
col= color(80,80,230,200);
button = createButton('play');
button.position(150, 252);
button.size(170,30)
button.style("font-size", "17px");
button.style("color", "#fff");
button.style("background-color",col)
button.mousePressed(toggleVid); // attach button listener
}
function toggleVid() {
if (playing) {
fingers.pause();
button.html('play');
} else {
fingers.loop();
button.html('pause');
}
playing = !playing;
}
//tablet
function setup() {
var myCanvas = createCanvas(320, 250);
myCanvas.parent('myContainer');
var video = createVideo(['asset/m1.mp4','asset/m1.webm']);
background(0);
video.position(0, 0);
video.play();
video.showControls();
}
function draw() {
}
コメントを残す