<?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 time() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=time%28%29</link>
      <pubDate>Sun, 08 Aug 2021 17:51:56 +0000</pubDate>
         <description>Tagged with time() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedtime%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Save frames of a video in a grid</title>
      <link>https://forum.processing.org/two/discussion/28006/save-frames-of-a-video-in-a-grid</link>
      <pubDate>Tue, 22 May 2018 15:35:39 +0000</pubDate>
      <dc:creator>domm</dc:creator>
      <guid isPermaLink="false">28006@/two/discussions</guid>
      <description><![CDATA[<p>Hey,</p>

<p>first, im really new to p5.js / processing.
I just got a new book "creative coding in web", their is an example which will save frames of a video in a grid.
My problem is, i dont get how the time measurement works, for me it seems to be really buggy. Everytime i run the sketch the result looks different. (Here is the example <a href="https://alpha.editor.p5js.org/generative-design/sketches/P_4_2_2_01" target="_blank" rel="nofollow">https://alpha.editor.p5js.org/generative-design/sketches/P_4_2_2_01</a>)</p>

<p>It would be nice if anyone could help me out.</p>
]]></description>
   </item>
   <item>
      <title>Shuffle mode video's</title>
      <link>https://forum.processing.org/two/discussion/15357/shuffle-mode-video-s</link>
      <pubDate>Tue, 08 Mar 2016 11:06:23 +0000</pubDate>
      <dc:creator>Danieuwburg</dc:creator>
      <guid isPermaLink="false">15357@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone,</p>

<p>In short: My current project involves a arduino Uno and processing, PIR sensor sends a signal when a person walks past the sensor and a movie starts playing. So far so good, the code works perfecly but the problem i'm having is that we want multible movies playing in shufflemode. So when the PIR sensor is triggerd again processing start a differend movie. This is the code so far:
    import processing.video.*;
    import processing.serial.*; //importeer Serial library</p>

<pre><code>Movie myMovie;
boolean MoviePause = true;
String Sensor;
Serial port;
String serial;   // nieuwe string 'serial'
int end = 10;    // 10 is ASCII voor linefeed (einde van serial.println)

void setup() {
  fullScreen();
  background(0);
  noStroke();
  fill(102);
  Sensor="0";
  port = new Serial(this, Serial.list()[0], 9600); // baudrate (snelheid) moet hetzelfde zijn als op de Arduino
  port.clear();  // serieele poort schoonmaken zodat er geen zooi in zit
  serial = port.readStringUntil(end); // lees poort totdat er een linefeed zit
  serial = null;
  background(0);
  myMovie = new Movie(this, "F:\\Droombus.mp4"); //hier natuurlijk je eigen verwijzing naar film zetten
  myMovie.loop();  //film in een lus zetten, want stoppen betekent niet meer kunnen starten (althans, zonder hem helemaal opnieuw aan te maken)
}

void draw() {
  background(255);
  image(myMovie, 0, 0);
    while (port.available() &gt; 0) { //zoalng er data op de poort komt, uitlezen en opslaan
    serial = port.readStringUntil(end);
  }
  if (serial != null) {  //data gevonden
      String[] a = split(serial, ',');  //data komt binnen, gescheiden door komma's
      Sensor = (a[0]);
      Sensor = trim(Sensor);
      println(Sensor);
  }

  if (myMovie.time() == myMovie.duration()){  //einde van de film bereikt.
    println("einde filmpje");
    myMovie.pause();    //dan op pauze zetten. Niet stoppen dus!!
    MoviePause=true;    //aangeven dat de film op pauze staat
  }
  if ((Sensor.equals("1") == true) &amp; MoviePause==true){  //als de sensor weer 1 is (dus beweging) EN de film is afgelopen
    println("Sensor check");
    MoviePause=false;
    myMovie.play();                                      //dan opnieuw verder afspelen (want staat in een lus)
  }
}

void movieEvent(Movie m) {
  m.read();
}
</code></pre>

<p>Please can someone help us to fix the code we're kinda stuck on this problem</p>

<p>Thanks.</p>
]]></description>
   </item>
   <item>
      <title>how to make a video: play + jump + play + jump …</title>
      <link>https://forum.processing.org/two/discussion/13095/how-to-make-a-video-play-jump-play-jump</link>
      <pubDate>Sun, 18 Oct 2015 17:46:20 +0000</pubDate>
      <dc:creator>ms68</dc:creator>
      <guid isPermaLink="false">13095@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I am also new to processing and would be very thankful if someone could help me with the following issue.</p>

<p>With the help of the video library I am trying to play a video that randomly jumps forwards, plays a limited and random amount of time and jumps randomly forward and plays again randomly until it reaches its end and repeats/loops.</p>

<p>Jumping is random inbetween the parameters of 15 and 30 seconds. Playing between 5 and 13 seconds.
I only got him jumping but not playing inbetween the jumps … althought the code I can give is without jumping so far:</p>

<pre><code>int clip_duration_max = 13;
int clip_duration_min = 5;
int clip_jump_max = 30;
int clip_jump_min = 15;

import processing.video.*;
Movie sequence;

void setup() {
  //size(displayWidth, displayHeight);
  size(640, 480);
  frameRate(25);
  sequence = new Movie(this, "sequence.mp4");
  sequence.loop();
}

void draw() {
  image(sequence, 0, 0);
  sequence.read(); 
  int sequence_duration = int(sequence.duration()); // get sequence duration
  int sequence_time = int(sequence.time());
  int jumper = int(random(clip_jump_min, clip_jump_max));  
  int sequence_length = int(random(clip_duration_min, clip_duration_max));
  int next_jumping_point = sequence_time + jumper + sequence_length;
}
</code></pre>

<p>Can anybody help me guiding to the next steps?</p>

<p>Thank you!</p>
]]></description>
   </item>
   <item>
      <title>Audio time</title>
      <link>https://forum.processing.org/two/discussion/12751/audio-time</link>
      <pubDate>Wed, 30 Sep 2015 15:11:28 +0000</pubDate>
      <dc:creator>lviensen</dc:creator>
      <guid isPermaLink="false">12751@/two/discussions</guid>
      <description><![CDATA[<p>Como saber o tempo de duração de um áudio usando a biblioteca minim?</p>

<p>How to know the rhythm of hum Length Audio using a libraryminim?</p>
]]></description>
   </item>
   <item>
      <title>Vídeo</title>
      <link>https://forum.processing.org/two/discussion/12525/video</link>
      <pubDate>Tue, 15 Sep 2015 14:51:03 +0000</pubDate>
      <dc:creator>lviensen</dc:creator>
      <guid isPermaLink="false">12525@/two/discussions</guid>
      <description><![CDATA[<p>Como saber que o vídeo está em execução ou não?</p>
]]></description>
   </item>
   <item>
      <title>Delay on movie.play()</title>
      <link>https://forum.processing.org/two/discussion/11944/delay-on-movie-play</link>
      <pubDate>Mon, 03 Aug 2015 07:42:57 +0000</pubDate>
      <dc:creator>swisjnu</dc:creator>
      <guid isPermaLink="false">11944@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys, I'm trying to play four videos at the same time but it seems like the play() or loop() has a delay between each activation. I just want to play all of them together as I need all of them to be in sync. Is there anything I can do to make this work? Thanks.</p>
]]></description>
   </item>
   <item>
      <title>Heap Space Issue</title>
      <link>https://forum.processing.org/two/discussion/3893/heap-space-issue</link>
      <pubDate>Sun, 23 Mar 2014 17:58:20 +0000</pubDate>
      <dc:creator>winuuu</dc:creator>
      <guid isPermaLink="false">3893@/two/discussions</guid>
      <description><![CDATA[<p>I wrote a sketch to pair random strings from a text file with different clips. The program will run for a while but eventually crash due to there not being enough heap space. I don't understand how this is happening if I am resetting 'myMovie' and
'p' at the end of draw(). Any help would be greatly appreciated!</p>

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

PFont font;

String[] posts; // strings loaded in setup()
String[] videos = {"1a.mov", "2a.mov", "3a.mov", "4a.mov", "5a.mov", "6a.mov",
                    "7a.mov", "8a.mov", "9a.mov"}; // video clips

String post;
Post first; // First post
Post p; // Next iteration of posts

Movie myMovie;
String clip;
int count; // Iteration counter

int a = 0; // image()
float duration = 0; // Movie duration
float time = 0; // Movie time

void setup(){

  size(displayWidth, displayHeight);
  background(0);

  posts = loadStrings("posts.txt"); // load strings from file
  font = loadFont("HelveticaNeue-Bold-48.vlw"); // load font
  post = posts[int(random(posts.length))]; // use random post

  textFont(font); // Set text font 
  textSize(50);
  textAlign(CENTER);
  fill(255, 248, 43); // Yellow fill

  if (frame != null){
    frame.setResizable(true); // resizable window
  }  

  /** Random generation of initial clip and post */
  clip = videos[int(random(videos.length))];
  myMovie = new Movie(this, clip);
  makeTint();
  myMovie.play();
  count++;
  first = new Post(post);
  println("Playing clip: " + clip + " w/ post: " + "\"" + post + "\"");
  println("Iteration: " + count + "\n");
}

/** Will generate random clips and posts after initial clip **/
void draw(){

  if (a == 0){
    image(myMovie, 0, 0);
  }

  image(myMovie, 0, 0);

  duration = myMovie.duration();
  time = myMovie.time();

  /** If clip is at end **/
  if ((duration - time) &lt; 0.1){

    first = null; // Remove first post

    /** Reset clip **/
    clip = null;
    myMovie = null;
    clip = videos[int(random(videos.length))];
    myMovie = new Movie(this, clip);
    count++;

    makeTint();
    myMovie.play();

    /** Reset post **/
    p = null;
    post = posts[int(random(posts.length))];

    println("Playing clip: " + clip + " w/ post: " + "\"" + post + "\"");
    println("Post length: " + post.length());
    println("Iteration: " + count + "\n");

  }
    p = new Post(post);
}

/** Method needed to play clips **/
void movieEvent(Movie m){  
  m.read();  
}

/** Screenshot taken and saved if user mouse-clicks **/
void mousePressed(){  
  int random_number = int(random(1000000));
  save(random_number+".png");  
}

/*******************************************\ 
* Function: Create Tint of random color
*
* Parameter Description:
*-----------------------------------------
* none  
\*******************************************/
void makeTint(){
  tint(int(random(200, 255)), int(random(200, 255)), 
        int(random(200, 255)), 126);
}


/** Class for displaying post **/
class Post{

  /*******************************************\ 
   * Function: Post Object Constructor
   *
   * Parameter Description:
   *-----------------------------------------
   * t, text to display
  \*******************************************/
  Post(String t){
    text(t, width/2, height - 150);    
  }

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Overlaying text from a String array onto changing Video Clips</title>
      <link>https://forum.processing.org/two/discussion/1874/overlaying-text-from-a-string-array-onto-changing-video-clips</link>
      <pubDate>Thu, 05 Dec 2013 17:11:47 +0000</pubDate>
      <dc:creator>lchit</dc:creator>
      <guid isPermaLink="false">1874@/two/discussions</guid>
      <description><![CDATA[<p>I am trying to display text from a String array onto video clips, where it displays as one string per clip; so when the clip changes, the text changes.</p>

<p>What I have so far isn't working, can someone help me with the logic? This is what I have so far:</p>

<pre><code>PFont font;

String[] posts;
String[] videos = {"1.mov", "2.mov", "3.mov", "4.mov", "5.mov", "6.mov",
                    "7.mov", "8.mov", "9.mov"};

Movie myMovie;

int a = 0;
int count = 0;
float duration = 0;
float time = 0;

void setup(){

  size(displayWidth, displayHeight);
  //background(0);

  posts = loadStrings("posts.txt");
  font = loadFont("HelveticaNeue-Bold-48.vlw");


  if (frame != null){
    frame.setResizable(true);
  }

  myMovie = new Movie(this, videos[int(random(videos.length))]);
  myMovie.play();

  text(posts[int(random(posts.length))], 250, displayHeight - 300);
}

void draw(){

  if (a == 0){
    image(myMovie, 0, 0);
  }

  image(myMovie, 0, 0);

  float duration = myMovie.duration();
  float time = myMovie.time();

  if ((duration - time) &lt; 0.1){

    myMovie = null;
    myMovie = new Movie(this, videos[int(random(videos.length))]);
    count++;
    myMovie.play();
    text(posts[int(random(posts.length))], 250, displayHeight - 300);
  }
}

void movieEvent(Movie m){  
  m.read();
}
</code></pre>
]]></description>
   </item>
   </channel>
</rss>