Random Video

Hi Guys,

Please could you help me with a very urgent issue.

I Have a folder (folder c:/videos) with 5 videos I need to start playing one of the videos of this folder randomically and if a Constant change to 1 the file that is playing have to start from the beginning.

Could you help me please, very urgent

thanks

Hi, this uses a folder and a chop execute to select a random movie every time the movie restarts. You can simply export a channel to the Cue parameter in the moviefilein TOP to restart it.
random_movie.tox (1.14 KB)

Hey thanks for this, I think it’s really close to something I’m trying to figure out.

I am new to TD and know little about Python. I think I understand the script you’ve written in the CHOP Execute but I was wondering if you could elaborate a bit on the logic in it?

I have adjusted the Folder DAT to a folder of movies I have, but ultimately the Text DAT is pointing to the whole folder instead of picking a movie in it and I’m not sure why. I thought it could have been because of the on/off columns in the folder and selecting the wrong 0 or 1, so I shut all of them off except Path, but that didn’t seem to help.

Any help would be greatly appreciated!

Hello there,

It appears I posted a less than functional component :blush:

The first problem is that in the folder1 DAT, in the “columns” tab, only “path” should be on, so that the chopexec1 grabs the full path to the randomly selected video and puts it in the text1 dat

The second problem is that the exec dat relies on the video to finish in order to trigger the script, but if there is no video at first to finish, then it will never trigger, so I added a button to manually trigger.

I hope this helps

Ian
random_movie.tox (1.99 KB)

One thing to consider is that playing a random video is different than creating a random order for your videos.

Playing any random video means that you could (and probably will) repeat a video before cycling through the whole set. The python random function is sudo random numbers. If you want to create a random sequence, you’ll want to shuffle.

[url]https://docs.python.org/2/library/random.html[/url]

There are a number of ways you might approach this, but the idea here is that you first make a list of all of your assets (or stand in numbers), which you then shuffle into a random order so you don’t have any instance of repeating the same item. You can then play through this list. When you get to the end of the list, you shuffle again and start from the beginning.

You might put this list into storage, or if you want to keep it in DATs you could use a reorder DAT.

There’s also the sort DAT, which might honestly be a much more straightforward approach.
base_random_order.tox (2.06 KB)

1 Like

You can also use a Sort DAT, with:
Sort = one of the “Rows” options
Sort order = Random
Preserve first = true

That’ll shuffle the rows randomly while still keeping the column headers on the top row. You can then look at the second row (the first one that’s not the headers) to decide what video to show.
If you want to re-shuffle it, change the Seed parameter on the Sort DAT (doesn’t really matter what the value is, it just matters that you’re changing it).

Thanks to everyone that posted replies in this thread.
I found the solutions informative tonight!!!

-Casey

Can you put a screenshot of where I enter the folder please? I can’t understand all the steps…

did you ever get an answer to this ?