For Makey MakeyQuick 8 key video keyboard

I have frequently seen people looking for a quick and easy way to hook up a makey makey and have it to play up to eight videos. Here’s the code I worked out from existing pieces I found on the web. Make a data directories, and then put a splash.jpg image and eight MP4 files, numbered from 1 to 4. As a code exists now I do not have t completely set up for the makey makey, just go into the various routines for playing each of the video files and replace the value for your key. I hope this helps out people who are just looking to do something fast for things like workshops.

import processing.video.*;

PImage img;
Movie myMovie[];
float t0;
float t;
int index = 0;

void setup() {
  fullScreen();
    img = loadImage("splash.jpg");
      background(0);
  image(img,  0, 0, displayWidth, displayHeight);

  myMovie = new Movie[8];

  myMovie[0]  = new Movie(this, "1.mp4");
  myMovie[1]  = new Movie(this, "2.mp4");
  myMovie[2]  = new Movie(this, "3.mp4");
  myMovie[3]  = new Movie(this, "4.mp4");
  myMovie[4]  = new Movie(this, "5.mp4");
  myMovie[5]  = new Movie(this, "6.mp4");
  myMovie[6]  = new Movie(this, "7.mp4");
  myMovie[7]  = new Movie(this, "8.mp4");

  myMovie[0].pause();
  myMovie[1].pause();
  myMovie[2].pause();
  myMovie[3].pause();
  myMovie[4].pause();
  myMovie[5].pause();
  myMovie[6].pause();
  myMovie[7].pause();

}


void draw() {
  background(0);
  image(img,  0, 0, displayWidth, displayHeight);

  if (myMovie[index].available() ) {
    myMovie[index].read();
  }
  image(myMovie[index], 0, 0, displayWidth, displayHeight);

  if (t > myMovie[index].duration() + t0) {
    println("finished! "+index);
      background(0);
  }

  t  = millis()/1000;
}

void keyPressed() {
  if (key == 'a') {
    myMovie[0].play();
    index = 0;
    t0 = millis()/1000;
  myMovie[1].pause();
  myMovie[2].pause();
  myMovie[3].pause();
  myMovie[4].pause();
  myMovie[5].pause();
  myMovie[6].pause();
  myMovie[7].pause();
  }

  if (key == 's') {
    myMovie[1].play();
    index = 1;
    t0 = millis()/1000;
  myMovie[0].pause();
  myMovie[2].pause();
  myMovie[3].pause();
  myMovie[4].pause();
  myMovie[5].pause();
  myMovie[6].pause();
  myMovie[7].pause();
  }
  if (key == 'd') {
    myMovie[2].play();
    index = 2;
    t0 = millis()/1000;
  myMovie[0].pause();
  myMovie[1].pause();
  myMovie[3].pause();
  myMovie[4].pause();
  myMovie[5].pause();
  myMovie[6].pause();
  myMovie[7].pause();
  }
    if (key == 'f') {
    myMovie[3].play();
    index = 3;
    t0 = millis()/1000;
  myMovie[0].pause();
  myMovie[1].pause();
  myMovie[2].pause();
  myMovie[4].pause();
  myMovie[5].pause();
  myMovie[6].pause();
  myMovie[7].pause();
  }
      if (key == 'g') {
    myMovie[4].play();
    index = 4;
    t0 = millis()/1000;
  myMovie[0].pause();
  myMovie[1].pause();
  myMovie[2].pause();
  myMovie[3].pause();
  myMovie[5].pause();
  myMovie[6].pause();
  myMovie[7].pause();
  }
    if (key == 'h') {
    myMovie[5].play();
    index = 5;
    t0 = millis()/1000;
  myMovie[0].pause();
  myMovie[1].pause();
  myMovie[2].pause();
  myMovie[3].pause();
  myMovie[4].pause();
  myMovie[6].pause();
  myMovie[7].pause();
  }
  
    if (key == 'j') {
    myMovie[6].play();
    index = 6;
    t0 = millis()/1000;
  myMovie[0].pause();
  myMovie[1].pause();
  myMovie[2].pause();
  myMovie[3].pause();
  myMovie[4].pause();
  myMovie[5].pause();
  myMovie[7].pause();
  }
    if (key == 'k') {
    myMovie[7].play();
    index = 7;
    t0 = millis()/1000;
  myMovie[0].pause();
  myMovie[1].pause();
  myMovie[2].pause();
  myMovie[3].pause();
  myMovie[4].pause();
  myMovie[5].pause();
  myMovie[6].pause();
  }
}

type or paste code here

type or paste code here