Stop (not pause) a media player and restart play

Ok, so I’ve only recently started playing around with UE4, I’ve followed this tutorial to play a simple in-game video:

, but in this case the video starts playing as soon as I start the level. I tried playing around with that a bit and easily managed to pause/play the video, simply by disconnecting the “Open Source” node from the BeginPlay Event and inserted 2 keystrokes for Play and Pause.

Now what I want is stop the video completely with a keystroke (that is “close” the TV) and then reopening it with another keystroke (or toggle on/off with a single key). I thought that would be quite easy, but I didn’t find any “Stop” function. I tried Rewind+Pause but the video pauses at that specific second. I wanted the screen to be black (as if the TV is completely closed) and then restarts.

Am I doing something wrong? I only found a Close function, but that would close the Media Source completely and I would then have to reopen it, which doesn’t seem like the most efficient way to do in runtime.

2 Likes

So I guess this is really harder than I thought it would be?

To prevent playback on level load, disable PlayOnOpen on your MediaPlayer.

To stop playback and unload your media, call Close like you said.

What should the behavior of a hypothetical Stop function? I guess you’re looking for a way to clear the media texture without unloading the media?

My video doesn’t start playing on level load, but with a ‘P’ keypress.

My issue basically is that I want my screen to be black with I press ‘P’ again. I was hoping to achieve this without closing the media source and re-opening it if I wanted to play the video again.

That’s why i’ve set my blueprint (see above) on the second ‘P’ press to rewind (to the first BLACK frame) and pause. Instead it seems to just pause to the current frame and simply starts over with I play it again.

Maybe another way would actually be what you said, switching material to a matte black when I 'turn off" the TV. Any help on how to implement this?

Hoping that by writing a comment here someone will re-view this issue with the new Media Framework.

Hi Nikpap, did you ever find a solution to this? I’m encountering the very same thing, I use a close function, but it just seems to pause. Strangely, when I have the Media Player window open (where you can set it to loop or play on open) it seems to work just fine by going to a black screen when I click the button I assigned to close, but obviously that shouldn’t have to be the case, I’m stumped. I’d be super grateful for any info you may have found on the issue.

Ok I found the answer, make sure ‘Auto Clear’ is checked: 4.18 Video Textures displaying white instead of black - Asset Creation - Unreal Engine Forums

Hey there,

The only easy solution I found is to get “Seek” node from MediaPlayer variable, split pin and literally set everything to 0.

If you use Video Source File like MP4:
There’s no a such node to achieve this. But I use a trick to do so.
Use the Rewind and Pause node could stop the video, but the texture will not update. Which looks like the video is paused not stopped.

To achieve that idea, you need to update the material by hand, just pick your first frame of your video and update it to your video material. So that you can make your video plane stop at the first frame.

But If you use Img Media Source:
Just use Rewind with Pause node, you can achieve the result you want.

1 Like

Easiest way:

  1. Get Media Plate Object (not Component)
  2. Set it invisible (Set Actor Hidden In Game)