Unreal’s built-in Media Player should be able to handle it; specifically, I’d look at the Open Source (to open a media file), and Play (to, well, play said file) nodes.
While the documentation on Media Player is a little slim, a quick journey to the universal global helpdesk (i.e., Google) turned up what at first glance looks like a reasonably nice tutorial on streaming media in-game.
I only skimmed it, admittedly, but I’d imagine even if it’s not enough to get you where you’re trying to go entirely (especially since it focuses on streaming video), it’s probably at least a starting place for working with Media Player.
This works perfectly! Didn’t know the media player could play sound files! Even works for URLs!
To play local files that the user can choose at runtime, use Open File. Open Url works at runtime, too. You’ll probably also want to bind On Media Opened & On Media Open Failed so you know when the media is opened.
Though, I tested it on a few ogg files, and it didn’t work (it did for mp3 & wav). I’m on 4.20. If you can’t get it to work for you, Rama’s plugin and RuntimeAudioImporter can play ogg.
Yeah, I should probably have also mentioned the CanPlayURL node, which will check if it’s a media file that’s usable or not.
Still, that the Media Player doesn’t natively support ogg doesn’t entirely surprise me, especially as far back as 4.20; it’s mildly disappointing, granted, but not all that surprising.
I had problems getting this to work from the UMG UI. After you add this code, you have to follow instructions in the link below. I give a quick and dirty explanation.
In order to use media player from UMG UI, you have to add the Media Sound component to an object in your scene. So click a wall for example, click add component, choose Media Sound in the drop down, then select the Media player you added in your folder. Then use the above code and it will work.
Okay, I got the volume multiplier to plug in, but it still doesn’t work, no matter if I set it before or after. Here’s my code. This is from the level blueprint.
The music mp3 file plays, but I have no volume control.
I assigned the media sound component from the level to the Music Sound Class, but the Music Slider volume control doesn’t work; it only works for music played normally outside the media player.
FYI, I made a new post with more detailed information. I still can’t get the volume control to work. I post this as a courtesy since you seem to be genuinely interested in this, thanks!