Simple Random Playback

By Hal MacLean

For a sample project and disc image click here.

Having recently been asked about randomising playback of just three tracks, it seemed enough of an incentive to think through the issues and come up with a very simple way of doing things.

The first thought was that with only three clips there is a really small number of possible playback orders. As long as all three must be played back, and there is no repeat or user choice involved, we can simplify things a great deal by using stories.

You will know by now that stories are not much more than play lists, and that markers inside stories can be set into any order, repeated and omitted as you need. Care must be taken when there are long video clips and multiple markers within each, as during playback you can easily introduce pauses, but with three short clips this won’t be an issue.

Accordingly, the most simple solution involved a number of stories and a simple script - very simple, in fact!

The track has got all three clips in it one after the other, with markers separating them. Adding six stories means that every combination of playback can be created simply by adding markers to stories in the right pattern. For example, story one has the clips in the order 1, 2 and 3. Story two has them in the order 1, 3, 2. This logical patterning is repeated for the markers in the remaining stories and then all we need to do is create a script to randomly select one of six stories.

The script acts as the button target from the menu where the random playback button is located. Create the script and add the following lines:

ran GPRM0, 65535
mod GPRM0, 6
Jump track1:story1 If (GPRM0 = 0)
Jump track1:story2 If (GPRM0 = 1)
Jump track1:story3 If (GPRM0 = 2)
Jump track1:story4 If (GPRM0 = 3)
Jump track1:story5 If (GPRM0 = 4)
Jump track1:story6 If (GPRM0 = 5)

Now, make sure that the end jump for each story is set to ‘Same as Track’ and that the end jump for the track goes to the menu. If you really want to be certain, you can always write a second script to clear GPRM0 and then jump to the menu and point the end jumps at that, but it shouldn’t be necessary.

Finally, if you want a button on your menu to play all of the clips in order, either point it to the track, or to the story which contains clips in order 1, 2 and 3. Additionally, you may want to only play a single clip - in which case add stories for each clip individually and use those.

It really is a simple random playback, and it is simple because we are doing all of the logic ourselves instead of using the built-in maths of your DVD player.

For a sample project and disc image click here.