Hello! I can’t seem to figure out how to randomize the input into the renderer so that it picks one of three videos to play. All videos are the same size, so it’s been easy to use togedge to hit the bang and pick a random number, but when I try to group the videos and have them picked randomly, it’s always the leftmost video that gets picked despite the randomization. I’ve probably messed up something really basic, but what’s going wrong here?
(This may be an issue solved via a video tutorial, but my hearing is not fantastic and the subtitles on the video tutorials are… not the best, I shall say gently. So unless someone has a transcript of the video tutorials, it’s a bit troublesome for me to use them.)
can you share a patch illustrating the problem?
I would love to, but it’s not letting me upload the patch. Says the screenshot is fine, though?
Do I see it correctly that your the IO box containing the “…second moment…” is connected twice?
Ah. So it is. Thank you, I didn’t realize I’d done that!
It’s still not playing or randomizing, but at least I have all three videos where they belong, and I got a trust upgrade so I can upload the actual patch now!
TryptichTest3.vl (17.3 KB)
Right, I’m on my phone and cannot open the patch right now ;)
However, i think you could surround the random node inside a Cache region (right click on Random > Surround > Cache).
Also put a Togedge after => node, then with each Upedge, Force the Cache Region!
I might be wrong but I thought Video Player had a normalized Progress output pin?!
@chk didn’t you share that?
I wonder why the duration says NaN, do your files play at all?
you can always step through the execution of your patch frame by frame using F6. create some more “debug” io boxes at crucial places and watch closely where things go wrong or not as expected.
What exactly do you mean?
In my case your patch works pretty well. Amir is right, you should definitely put a TogEdge after the condition, so you get a single bang. Just for the overview, I’ve put the FrameDelay after the bang and at the very bottom… also you should connect the bang to “Seek” of the VideoPlayer, because if the random number matches the video currently playing, it just stops.
TryptichTest3.vl (18.0 KB)
Oh! I did not know it was doing that. Thank you, that’s extremely helpful!
you might also consider not having spaces and () in the file path
I also had a go at it, I did it in a way that preloads all the videos, then it will not have a slight stutter when the file is renewed and or loops.
TryptichTest3s.vl (17.2 KB)
you should set loop on the VideoPlayer, then it will behave if it selects the same number again
TryptichTest3s2.vl (17.9 KB)
In your example there is now the VideoPlayer inside the loop, don’t know what it is doing in the background resource-wise, if one wants to switch between hundreds of videos? I liked the initial idea that there is only one VideoPlayer node, but switching to a different path.
Note: resource-wise there is a non-zero chance that I will be given a 2001 dell laptop, so there is probably very little I could do to optimize for that, and also if I explode a laptop with my installation that also bears artistic merit.
@chk Sure if you end up with hundreds of videos, it might be problematic, but I have routinely used a similar approach, first in beta and now gamma.
A method that might be better would be to have two players and switch between them, loading one, while the other is playing. but if it is less than 10, I don’t see much of a problem.