Switch between videos

MyrtleV's icon

Hello all, I am making my first patch, assistance gratefully received.

I am aiming for switching between these 12 videos, however only one is playing (from input note 12, Common_starling.mp4).

What is missing to enable the switch?

MyrtleV's icon

NB I changed the select range from 0 to 11.

Do I need to add multiple jit.windows?

yaniki's icon

Connect and send messages to the [jit.movie] object ;-)

Also use "read" (or "asyncread") instead of "switch".

MyrtleV's icon

That's worked! Thank you!

Now my MIDI messages are coming in pretty fast from the Midi sprout.

Is there a way to tell the video to finish playing, before reading a new video?

yaniki's icon

You can send "stop" message to the [jit.movie] to stop playing or "dispose" to, let's say "unload" video.

You may be also interested in @output_texture 1 attribute of the [jit.movie] - if your videos are using high resolution formats this attribute may positively affect frame rate and general performance of your patch.

MyrtleV's icon

Hi, thanks again...

I added @output_texture 1, but now the videos are not appearing or playing in the jit.window.

I should have been more clear: I would like each video to play until the end, and only when it is finished to start a new one. So I guess, either the note in would need to be paused until the video is finished, or a new object or message added which can tell the video to play to the end?

Thanks

yaniki's icon

Hello

Ok, there are several methods to build something you need. One of the simplest (in my opinion) solutions could be created around this mechanism (it's a patch copied to post with "copy compressed" Max feature. To use it: click it, click "copy to clipboard", open Max, go to File -> New From Clipboard):

Max Patch
Copy patch and select New From Clipboard in Max.

MyrtleV's icon

Hello Yaniki,

That's worked perfectly! Many thanks again!

There is one extra thing I wish to include in the patch. I'd like an image (pdf, jpeg, it doesn't matter) to display at the same time as each video (there is a matching image for each video).

Should this new part of the patch be connected to the buttons coming from the notein and selected pitch, or to the loop part?

yaniki's icon

Again you can make very different things, depend on your needs. Look at attached example (zip file, this time) - it's a simple mechanism for choosing between pairs (image + video) to display.

example.zip
application/zip 446.90 KB

MyrtleV's icon

Thanks ;)

I have attempted to make the changes, but the images are not displaying in the jit.window...can you see where I need to change it?

yaniki's icon

The first thing I see is related to the "gate" object - connect messages containing images names to the second inlet of the "gate" ;-)

MyrtleV's icon

Whoopsie!

Have fixed that...but still no images :(

MyrtleV's icon

The pngs are not numbered 1-12 in the library: does that matter?

yaniki's icon

If you have an image named "myimage.png" put string "myimage.png" into the message box - no additional characters.

MyrtleV's icon

Changed it...still no .pngs coming up.

I checked the size of the images are all within the parameters in the jit.movie.

MyrtleV's icon

I got it! prepend read.

Thanks again for all your help Yaniki :)