This may sound a bit complicated, but I'll make it as simple as possible.

What I need is a program that can play media as a kind of looping playlist. For example it would play a video, then a series of slides with music, then a video again. I'm sure keynote or pro presenter would do the trick, but here comes the interesting part. While playing a video, it plays the videos audio, while playing a series of images, it plays a random song off a playlist. When the song (or any number of songs) is done, it moves onto another video file. The basic goal in mind is to create on the fly these kinds of looping playlists. Is there a program that can accomplish this task?