Play a sound file - show widget - click - play a sound - ?

Hi all!

I’d like to do a simple ‘answer the question’ game. The engine should play the audio (question), then show a widget…player clicks the answer (yes or no…I already have this widget clickable), then it plays another sound file (question 2)…widget, click…and so on.
How can I do it with blueprints?

Thanks!

Hey there!

Not sure if you’re still looking for tips on playing audio with UE4, but here’s something that might help if you are!

I needed to be able to play audio files without loading them into UE4 as assets first, since some of them were going to be generated at runtime. The answer from preston_sony was particularly helpful to me. To summarize his answer:

  • Create a MediaSource, and set its StreamUrl property to be the file location (preceded with “file://” and using “/” instead of "")
  • Create a MediaPlayer, and instruct it to OpenSource using the MediaSource you created.

I haven’t played around with the MediaPlayer too much, so I’m not sure if there’s an easy way to tell when you reach the end of an audio file (which I assume would be useful for you). There might also be simpler ways to accomplish this goal if you’re able to use sound files that you’ve dragged into the editor as assets. I just figured I’d share what I found since I opened this question while searching for how to accomplish my task!

Hope that helps!