<?xml version='1.0' encoding='UTF-8'?>

<?xml-stylesheet href="./_c74_tut.xsl" type="text/xsl"?>

<chapter name="Video and Graphics 1: Display a Video">

<previous name="jitterchapter00b_whatareattributes">Editing Jitter object parameters</previous>
<next name="jitterchapter00d_Live Capture">Live Capture</next>
<parent name="jitindex">Jitter Tutorials</parent>

<openfile name="Display a Video" patch="jitter_core_-_1_-_display_a_video.maxpat"/>

<h1>Video and Graphics Tutorial 1: Display a Video</h1>



<h2>Play a video in your patcher</h2>



<p>We're going to get started using Jitter by creating a display window and showing a video in two different ways.</p>

<h2>The World</h2>
<p>Our first step is to create a <o>jit.world</o> object. After you create the <o>jit.world</o>, a display window will appear on your screen. This is where we’ll render all of our output. The <o>jit.world</o> object is at the center of most Jitter patches, since it provides a lot of core functionality - such as this display window, as an example.  You can name this window by providing an argument to jit.world (we're using <m>myworld</m> in this
example). Naming your world creates a specific and unique context, which you will learn to use in later tutorials. Now let’s make it do something.</p>

<h2>Displaying the Movie</h2>

<p>The first thing we’ll do with our <o>jit.world</o> is display a movie.  First, we’ll need to turn <o>jit.world</o> rendering on. To get it working, create and attach a <o>toggle</o> box to the inlet.</p>


<illustration><img src="images/jitter_core - 1a.png"/>setting up your world</illustration>

<p>Click on the video icon on the left sidebar of your patcher window to show the Video Browser.</p>

<illustration><img src="images/1aA.png"/>loading a video</illustration>

<p>Click on the name of a video and drag it from the browser to an empty spot in your patcher windoe. This creates a <o>jit.playlist</o> loaded with the video of your choice.  You can also drag other videos onto this <o>jit.playlist</o> object to load more videos for displaying.</p>

<p>In order to see the video displayed, we need to connect the left outlet of the <o>jit.playlist</o> to the inlet of the <o>jit.world</o> object.  Click on the lock icon at the lower left
corner of the patcher window to lock the patcher, click on the <o>jit.world</o> toggle, and click the <o>jit.playlist</o> object's play button. The video should be displaying in the display window.</p>

<illustration><img src="images/jitter_core - 1b.png"/>play some video</illustration>

<h2>A More Basic Option</h2>

<p>There will be times when you don't need the user interface and features of a <o>jit.playlist</o> object, or times when  you want to have a more direct programming interface for video playback. For these cases, the <o>jit.movie</o> object will be more useful.</p>

<p>Let’s start by unlocking the patch, creating a <o>jit.movie</o> object, and connecting its output to the inlet of the <o>jit.world</o> object (We can disconnect the <o>jit.playlist</o>, since we won't be using it). To load a movie, create a <o>message</o> box containing the word <m>read</m> and connect it to the inlet of <o>jit.movie</o>. Lock the patcher and click the <o>message</o> box to open a file dialog box that will let you browse your computer and select a video file to play.</p>

<p>We can send other messages to <o>jit.movie</o> to control playback. Try creating some new <o>message</o> boxes containing the messsages <m>stop</m>, <m>start</m>, <m>jump 5</m>. Connect their outlets to the inlet of <o>jit.movie</o> and explore using them to control your video.</p>

<illustration><img src="images/jitter_core - 1d.png"/>play some video</illustration>

<div>
	<techdetail>The <o>jit.movie</o> object has an impressive number of special messages and attributes, so you’ll probably want to spend some time exploring the help patch and reference for more ways to manipulate playback.</techdetail>
</div>

<p>If you want to view the video <i>inside your patcher window</i>
 rather than in another window, you can use the <o>jit.pwindow</o> object, which embeds a display window in your patch. Make one and try connecting the its inlet to the outlet <o>jit.playlist</o>.</p>



<h2> Technical Notes </h2>

<ul>

			<li><link type="vignette" module="core" name="jitter_video_engines">Video Engines</link></li>

			</ul>



</chapter>
