I’m trying to play a video in UMG, and getting video but no audio playing.
Here are my steps:
Import video as File Source
Create new Media Player and associated Media Sound Wave and Media Texture
When I open up the Media Player, and then double click on the File Source in the bottom left it opens up and plays fine with video and audio at this point.
I created a UMG Widget
In the widget, I added an Image, and set the Brush to be the Media Texture (this is how I did it in versions prior to 4.13)
In the Widget BP I did ‘Open Source’ for the Media Player.
In the Level BP, I added the widget to the viewport
This all works fine for the video to play in a UMG widget, but I am getting no audio. What am I doing wrong?
It’s weird because prior to version 4.13 it was very easy to get this up and running – it just worked. Having to export separate WAVs for audio seems like it should be an unnecessary step – and I imagine keeping audio/video in sync will be harder if they’re separate files.
Hopefully one of the devs can weigh in and explain how this works in the new version.
So when you play a movie using the new Media Framework player, it feeds two assets with the content of the video. The video is sent to the texture file while the audio is sent to the sound file.
Just like with the texture needing to be assigned to a UMG widget or material, the audio needs to be spawned into your world. UMG doesn’t have any sound capabilities, all sound is handled as part of the game world.
So, long story short, you simply need to get a reference to your sound asset (That’s going to have the audio streamed to it from the video file) and tell it to play as a 2D sound!
And those images and description are as clear as mud. Where is this “sound asset” coming from? I’m in a widget blueprint with a Media Player variable - that’s it. The media source is a video file with sound. In fact I’m using a play list and not just a single media source. The videos play in sequence just fine. No sound. I see you have “Get” node of mysterious origin. I’m guessing you have placed your media asset in the level rather than in a widget.
Alright, for anyone stumbling across this, I’ve got some clarity here.
If you have a video that already has audio, you can use a free program like VLC to convert the video to an mp3 file and then use an online converter to turn it into a wav file. Wav files are what UE4 uses for sound. If you cue the video and audio in the same function, they will be in sync (maybe a millisecond delay as the code executes but really, that’s nothing). The Media Sound component would not be necessary if you are playing the sound in a widget, that’s for an actor somewhere in your level, like a tv or something like that. Just import the original video as a File Media Source, make a Media Player (in your content browser, ideally in the same folder as the source for organizational purposes) and use those two things to make a Media Texture that you can use in your widget.
Audio doesn’t play from the UI but you can add a MediaSound component in your PlayerController and then associate it with the UI’s Mediaplayer as shown below:
In controller
1 Add the component
2 On Beginplay, get your UI widget variable and pulled the Mediaplayer from it, then link the component with “Set Media Player”
3 On Tick, get your UI Widget and check if media is playing, and set the Volume accordingly on the Media Sound component.
Not sure if this is the best procedure, but it works for what I need.
I am successfully using this technique, however, when triggering videos to play using the media track in Sequencer I cannot get the audio to start with the video. The only way audio plays is if I set it to ‘auto activate’ but this results in sounds from all of my videos playing at once as the game loads.
Has anybody managed to successfully control the start of media textures in Sequencer with synced audio? (I’m using mp4 files for the video/audio)
this is so ■■■■ stupid yeah make things that were once easy harder what a waste of time and pay check whoever programmed this to be stupid like this should be fired and charged what they were paid.
I was running into a similar issue with 4.27 but using MediaSound caused the video to not even play.
I was trying to play the video while the game was paused, and I needed to enable “Tickable when Paused” on the MediaSound Component of my Actor, even though “Tickable when Paused” was already enabled on the base Actor itself.