Display a random video on an object
I am trying to display a random video on a plane object.
So far I am only able to display a specific video on a plane object at any given time:
I could really use the help.
asked Feb 13 '18 at 04:09 PM in Blueprint Scripting
You should be able to pick a random video to play if you add a MediaSource variable to your Blueprint and change it to an Array. Then on BeginPlay you can use a Random Integer in Range node to randomly select the index of a video from that array, then pass that video into the MediaPlayer. Here's an example of the node setup:
Inside your array of sources, you just need to add each media source you want to have a chance of playing and one will be picked at random when the game starts.
Edit: be sure to check that there is at least one video in the list before calling Open Source. If you overlook this (as I did) and pass in an empty array, you will probably crash.
I hope this helps!
Follow this question
Once you sign in you will be able to subscribe for any updates here