<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with eosevent() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=eosevent%28%29</link>
      <pubDate>Sun, 08 Aug 2021 19:01:25 +0000</pubDate>
         <description>Tagged with eosevent() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedeosevent%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Play and replay the video after few second of the playing time message.</title>
      <link>https://forum.processing.org/two/discussion/26370/play-and-replay-the-video-after-few-second-of-the-playing-time-message</link>
      <pubDate>Thu, 15 Feb 2018 21:10:43 +0000</pubDate>
      <dc:creator>moonilsun</dc:creator>
      <guid isPermaLink="false">26370@/two/discussions</guid>
      <description><![CDATA[<p>Hello</p>

<p>I was trying to make a code for playing my project. 
But I couldn't figure out how to make the same video play and after finished showing few second (maybe 5 seconds) of how many times video played. and again playing the video.</p>

<ol>
<li>after the finished video, then showing the message</li>
<li>the message counting how many times played.</li>
<li>5 sec after automatically play again.</li>
</ol>

<p>It could be a very obvious question, but few days of searching, I still couldn't find the solution...</p>

<p>please anyone can advise on this problem?</p>

<pre><code>import processing.video.Movie;

Movie vid;
boolean ended;

void setup() {
  frameRate(30);
  textSize(050);
  textAlign(CENTER, BASELINE);
  fill(0);

  vid = new Movie(this, "StudioOutside.mov") {
    @ Override public void eosEvent() {
      super.eosEvent();
      myEoS();
    }
  };

  vid.play();
  while (vid.width == 0 | vid.height == 0)  delay(10);

  surface.setSize(vid.width, vid.height); // P3
  //size(vid.width, vid.height); // P2
}

void draw() {
  if (!ended)  background(vid);
  else {
    if (key == ' ' || key == ' ') {
      keyPressed = true;
    if (keyPressed == true) {
     background(vid);
     vid.play();
    }
      } else {
    vid.stop();
    background(255);
    text("Playback has finished!", width&gt;&gt;1, height&gt;&gt;1);
  }
  }
}

void movieEvent(final Movie m) {
  m.read();
}

void myEoS() {
  ended = true;
  frameRate(1);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Movie.duration() always returns 0.0, framerate() and speed() do not seem to affect playback</title>
      <link>https://forum.processing.org/two/discussion/26225/movie-duration-always-returns-0-0-framerate-and-speed-do-not-seem-to-affect-playback</link>
      <pubDate>Sat, 03 Feb 2018 07:06:49 +0000</pubDate>
      <dc:creator>ajohnsonlaird</dc:creator>
      <guid isPermaLink="false">26225@/two/discussions</guid>
      <description><![CDATA[<p>I've just started to experiment with the Movie library and I've run into some basic questions.</p>

<p>Here's the testbed code:</p>

<pre><code>import processing.video.*;
Movie myMovie;
int screenSizeX = 800;
int screenSizeY = 600;
float duration = 0;

void settings()
{
  size(screenSizeX, screenSizeY);
}
void setup() {

  myMovie = new Movie(this, "20180201103135_20180201103155_01_M.dav");
  myMovie.frameRate(25);
  myMovie.speed(0.01);
  duration = myMovie.duration();
  println("setup duration =" + duration);
  duration = myMovie.playbin.queryDuration().toSeconds();
  println("setup playbin.queryDuration() duration =" + duration);
  myMovie.loop();
}

void draw() {
  image(myMovie, 0, 0);
  println("Duration=" + myMovie.duration());
}

// Called every time a new frame is available to read
void movieEvent(Movie m) {
  m.read();
  duration = myMovie.duration();
  println("movieEvent duration =" + duration);
}
</code></pre>

<p>When I run it, duration always appear to return 0.0 regardless of when I test it -- including if I call playbin directly (mimicking the library code at line 270 here: <a rel="nofollow" href="https://github.com/processing/processing-video/blob/master/src/processing/video/Movie.java">https://github.com/processing/processing-video/blob/master/src/processing/video/Movie.java</a> ).</p>

<p>The console output is:<br />
    setup duration =0.0<br />
    setup playbin.queryDuration() duration =0.0<br />
    movieEvent duration =0.0<br />
    Duration=0.0<br />
    Duration=0.0<br />
    movieEvent duration =0.0<br />
    Duration=0.0<br />
    :<br /></p>

<p>What I was really trying to do (apart from experimenting with playback at various speeds) was figure out how to detect when a Movie has finished playing? I've seen some example code that did this:</p>

<pre><code>if (myMovie.time() &gt;= myMovie.duration()) // Test if the playhead is at the end
{
   // end of Movie
}
</code></pre>

<p>Of course that's destined to fail if .duration() always returns zero. So that raises the question, how do you tell when a movie has finished?? I supposed I could check when .time() stops changing, but that squawks a dreaded red text error on the console when the code runs "off the end" of the Movie.</p>

<p>Anyone got any ideas how you test for when a Movie has finished playing? I need to work my way through a directory with hundreds of different movie files and extract individual frames -- I've figured out what I thought would be the hard part only to screech to a halt on this "simple" problem. :(</p>

<p>Oh....and anyone got any ideas why myMovie.frameRate() and .speed() don't appear to do anything?</p>

<p>Thanks in advance
Andy</p>
]]></description>
   </item>
   <item>
      <title>[video] Play random video sequence</title>
      <link>https://forum.processing.org/two/discussion/23419/video-play-random-video-sequence</link>
      <pubDate>Wed, 12 Jul 2017 21:41:14 +0000</pubDate>
      <dc:creator>andreminei</dc:creator>
      <guid isPermaLink="false">23419@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone,
I'm new to Processing and I've been working on this video-art / installation project for my graduation.</p>

<p>My question is:
How can I set a random video to be played next?</p>

<p>I managed to get the videos playing, but I can't set another random video to follow.
My intention is to have a sequence of videos (maybe 10 or more) that will play in a shuffled order.
I have looked around this and some other forums but couldn't find a specific answer.
Hope you guys can help me out. Thanks!</p>

<p>ps. if something doesn't make sense in my code please tell me :)</p>

<pre><code>import processing.video.*;
import processing.sound.*;

AudioIn input;
Amplitude analyzer;
int scale=4;

Movie mov1, mov2;
Capture cam;

int n = 5; //total number of videos

float vidN = random(1, n+1);
int x = int (vidN);

float vidN2 = random(1, n+1);
int x2 = int (vidN2);

void setup() {
  //frameRate (30);
  size(1280, 720);
  colorMode (HSB);
  //fullScreen();
  //background(0);

  mov1 = new Movie(this, nf(x, 2)+".mp4");
  mov1.loop();
  mov1.volume(100);

  mov2 = new Movie(this, nf(x2, 2)+".mp4");
  mov2.loop();
  mov2.volume(00);

  cam = new Capture(this, width, height);
  cam.start();  

  blendMode(DIFFERENCE);

  imageMode(CENTER);

  //Create an Audio input and grab the 1st channel
  input = new AudioIn(this, 0);

  // start the Audio Input
  input.start();

  // create a new Amplitude analyzer
  analyzer = new Amplitude(this);

  // Patch the input to an volume analyzer
  analyzer.input(input);
}

void movieEvent(Movie m) {
  if (m == mov1) {
    mov1.read();
  } else if (m == mov2) {
    mov2.read();
  }
}

void draw() {    
  float vol = analyzer.analyze();

  noStroke ();

  tint (255, 80);
  if (cam.available()) {
    cam.read();
    image(cam, width/2, height/2, width, height); // Draw the webcam cam onto the screen

    vol = vol*scale;

    tint (255, 100-vol*100);
    image(mov1, width/2, height/2, width, height);

    tint (255, 100-vol*100);
    image(mov2, width/2, height/2, width, height);
  }
}  
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to make keyPressed respond to the number of times the key is pressed</title>
      <link>https://forum.processing.org/two/discussion/16476/how-to-make-keypressed-respond-to-the-number-of-times-the-key-is-pressed</link>
      <pubDate>Sat, 07 May 2016 14:09:13 +0000</pubDate>
      <dc:creator>kk324</dc:creator>
      <guid isPermaLink="false">16476@/two/discussions</guid>
      <description><![CDATA[<p>I'm very new to Processing. I am working on a project that involves Makey Makey. 
I was wondering if it is possible to use keyPressed or something similar to respond to the number of times the key is pressed?
For instance, I want the user to press LEFT three times and RIGHT two times, and after that the video will play. Is there a way to do it?</p>
]]></description>
   </item>
   <item>
      <title>How to know that  video play is over</title>
      <link>https://forum.processing.org/two/discussion/17926/how-to-know-that-video-play-is-over</link>
      <pubDate>Sun, 21 Aug 2016 13:14:03 +0000</pubDate>
      <dc:creator>taewankim</dc:creator>
      <guid isPermaLink="false">17926@/two/discussions</guid>
      <description><![CDATA[<p>I want to reset to the initial processing at the end of this video, however , there is no way to know when the video ends
How should I want the end of the video to initialize all variables and to turn to its initial state ?</p>
]]></description>
   </item>
   <item>
      <title>How to make a video stop playing and screen++;</title>
      <link>https://forum.processing.org/two/discussion/16655/how-to-make-a-video-stop-playing-and-screen</link>
      <pubDate>Tue, 17 May 2016 05:06:19 +0000</pubDate>
      <dc:creator>gunnage</dc:creator>
      <guid isPermaLink="false">16655@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys, I have a basic set up of an animation storyline in which when the user clicks the mouse or does certain interactions, it then runs the next 'screen' or next animation. The issue I'm having is that on screen 5 a click of the mouse plays a video I made in after effects. However, this video then stops on the last frame and stays. I cannot work out how to 'screen++' after the video stops. I have tried duration, millis, etc. and nothing seems to be working. Could somebody please shed some light on what might be going on, or how I could achieve this?</p>

<pre><code>import processing.video.*;
Movie myMovie;

Cell[] cells= new Cell[1000];

float x, y;
PFont Baskerville;
int screen=1;
int drawRandomLines = 0;
int ellipseSize = 0;
int totalCells = 0;

void setup () {
  size(1024, 768);
  smooth(3);
  noStroke();
  Baskerville = createFont("Baskerville", 30);
  textFont(Baskerville);
  textAlign(CENTER);
  noStroke();
  x = width/2;
  y = 0;
  myMovie = new Movie(this, "dominant_species.mov");
  //myMovie.play();
}

void draw () {

  if (screen==1) {
    background(4, 16, 36);
    fill(255, 219, 157);
    noStroke();
    //draw first screen
    ellipse(512, 384, 16, 16);
    text("Here is a cell.", width/2, height/2-40);

    // } if (y &gt;= 384) {

    //y = height/2;

    text("Here is a cell.", width/2, height/2-40);
  } else if (screen==2) {
    background(4, 16, 36);

    fill(255, 219, 157, 20);
    rect(mouseX, 0, -mouseX, 768);
    fill(255, 219, 157);
    text("One of millions in the body.", width/2, height/2-40);

    cells[totalCells] = new Cell();

    totalCells ++ ;

    if (totalCells &gt;= cells.length) {
      totalCells = 0;
    }

    for (int i = 0; i &lt; totalCells; i++) {
      cells[i].move();
      cells[i].display();
    }

    if (mouseX &gt;= 900) {
      screen++;
    }

    if (mouseY &lt; 10 ) {
      screen++; //add one onto screen
    }
  } else if (screen==3) {
    background(255, 219, 157);
    //background(4,16,36);
    //draw third screen
    //testing to see if the mouse is inside a circle
    fill(4, 16, 36);
    text("Throughout our daily lives...", width/2, height/2-40);
  } else if (screen==4) {
    background(255, 219, 157);
    noStroke();

    text("our cells duplicate in order to heal and develop.", width/2, height/2+200);


    fill(4, 16, 36);
    ellipse(width/2-40, height/2-40, ellipseSize, ellipseSize);
    ellipse(width/2+40, height/2+40, ellipseSize, ellipseSize);
  } else if (screen==5) {
    background(4, 16, 36);
    noStroke();

    fill(255, 219, 157);
    text("That's how we've gone from a single celled organism...", width/2, height/2-20);
    image(myMovie, 0, 0);

    fill(4, 16, 36);
    ellipse(width/2-40, height/2-40, ellipseSize, ellipseSize);
    ellipse(width/2+40, height/2+40, ellipseSize, ellipseSize);
    //draw fifth screen
    //image(myMovie, 0, 0);
  }
}

//called only once when the user presses the mouse
void mousePressed () {
  if (screen==1) {
    //testing for a button notice it is the same bounds as the
    //rect we are drawing in the test for screen==1 inside draw
    //you could just write 170 instead of 130+40 but I left this
    //here so you can see how the test values relate to the rect coordinates
    float d = dist(mouseX, mouseY, 512, 384);

    if (d&lt;20) {
      screen++;
      //myMovie.play();
    }
  } else if (screen==5) {

    myMovie.play();
  } else if (screen==3) {
    screen++;
  }
}


//called whenever the mouse is movoed
void mouseMoved () {
  if (screen == 4) {
    ellipseSize=ellipseSize+5; 
    if (ellipseSize &gt; width) {
      println("threshold");
      //take us back to the beginning
      //reset all of our variables
      //screen=1;
      drawRandomLines = 0;
      ellipseSize = 0;
      screen++;
    }
  } else if (screen == 6) {
    //take a look inside the screen==5 inside draw
    //ellipseSize++; 
    //if (ellipseSize &gt; width) {
    //println("threshold");
    //take us back to the beginning
    //reset all of our variables
    //screen=1;
    //drawRandomLines = 0;
    //ellipseSize = 0;
  }
}


void movieEvent(Movie m) {
  m.read();
}


//NEW TAB__ CELL CLASS

class Cell {

  float x, y;   // Variables for location of raindrop
  float speed; // Speed of raindrop
  color c;
  float r;     // Radius of raindrop

  Cell() {
    r = 8;                 // All raindrops are the same size
    x = random(mouseX);     // Start with a random x location
    y = -r*4;              // Start a little above the window
    speed = random(1, 5);   // Pick a random speed
    c = color(255,219,157); // Color
  }

  // Move the raindrop down
  void move() {
    // Increment by speed
    y += speed;
  }

  // Check if it hits the bottom
  boolean reachedBottom() {
    // If we go a little beyond the bottom
    if (y &gt; height + r*4) { 
      return true;
    } else {
      return false;
    }
  }

  // Display the raindrop
  void display() {
    // Display the drop
    fill(c);
    noStroke();
    ellipse(x, y, r*2, r*2);
  }

}
`
</code></pre>
]]></description>
   </item>
   <item>
      <title>boolean isPlaying()</title>
      <link>https://forum.processing.org/two/discussion/15867/boolean-isplaying</link>
      <pubDate>Tue, 05 Apr 2016 21:09:51 +0000</pubDate>
      <dc:creator>clem</dc:creator>
      <guid isPermaLink="false">15867@/two/discussions</guid>
      <description><![CDATA[<p>Hi</p>

<p>I probably asked this in the wrong department. 
I have a sketch written in 1.5.1 which worked and is now not working and I am not sure why
it is hanging up on 
boolean isPlaying(){
return playing;
}
it is hanging up on 'playing'  cannot find anything named playing
not sure why.........
can anyone help?
just downloaded processing 1.5.1  (thought it best to stick to original version) on mac mini running 10.9.4  2.3GHZ Intel Core 17 processor and 4GB 1600MHz DDR3 memory</p>

<p>I can send all the code along if it helps?</p>

<p>Thanks</p>
]]></description>
   </item>
   <item>
      <title>Movie begin and end events</title>
      <link>https://forum.processing.org/two/discussion/14990/movie-begin-and-end-events</link>
      <pubDate>Thu, 18 Feb 2016 11:43:10 +0000</pubDate>
      <dc:creator>norbertRostaing</dc:creator>
      <guid isPermaLink="false">14990@/two/discussions</guid>
      <description><![CDATA[<p>Hello
I'm using the Movie class and I'm wondinering if there is some events when the movie starts (dunring the loop) to trigger some events and when the movie stops (at the end) to launch the next movie in a playlist or trigger other events
Does these events exists ? or should I use duration() and time() to trigger them myself ?
Thanks !</p>
]]></description>
   </item>
   </channel>
</rss>