greenhouse
a creative coding toolkit for spatial interfaces

Video

A video file in 3D space with round-able corners.

  • Video ()
  • SetVolume ()
  • Volume ()
  • Play ()
  • Stop ()
  • TogglePlay ()
  • Rewind ()
  • EnableLooping ()
  • DisableLooping ()
  • Duration ()
  • SeekToTime ()
  • NextFrame ()
  • PreviousFrame ()
  • Aspect ()
  • SetSize ()
  • SetDiagonal ()
  • Size ()
  • Diagonal ()
  • Width ()
  • SetWidth ()
  • Height ()
  • SetHeight ()
  • SetCornerRadius ()

Example

#include "Greenhouse.h"

void Setup ()
{ // create the video from file
  Video *v = new Video ("videos/movie.m4v");
  v -> SlapOnFeld ();

  v -> SetVolume (0.6);
  // check the current volume setting and print to console
  float64 volume = v -> Volume ();
  INFORM ("volume is set to " + ToStr (volume));

  // play the video
  v -> Play ();
  // stop the video
  v -> Stop ();
  // play the video
  v -> TogglePlay ();
  // rewind the video to the beginning
  v -> Rewind ();

  v -> EnableLooping ();
  v -> DisableLooping ();

  // retrieve the duration of the video & print it
  float64 duration = v -> Duration ();
  INFORM ("video duration is " + ToStr (duration));
  // seek the play head to halfway through the video
  v -> SeekToTime (duration / 2);
  // seek one frame forward and then one back again
  v -> NextFrame ();
  v -> PreviousFrame ();

  float64 aspect = v -> Aspect ();
  INFORM ("aspect ratio is " + ToStr (aspect));

  // set size in millimeters
  v -> SetSize (200);
  // set the size relative to the feld using SetDiagonal ()
  v -> SetDiagonal (0.25 * Diag (Feld ()));
  INFORM ("The distance between the two corners is " +
          ToStr (v -> Size ()) + "mm.");
  // or
  // INFORM ("The distance between the two corners is " +
  //         ToStr (v -> Diagonal ()) + "mm.");

  // get and set the video by its width
  float64 w = v -> Width ();
  v -> SetWidth ( 5 * w );
  // get and set the video by its width
  float64 h = v -> Height ();
  v -> SetHeight ( 0.5 * h );

  v -> SetCornerRadius (0);
}