Play a video when interacting with an object

Hello guys.
I’m making a project when I interact with an object pressing E, it plays a video in game.
The problem is that when I press E the video has already started before it. And when I press again the widget closes but the video is still playing if I press E again.
I would like to make it start playing only when I press E and stops and rewind when I press E again.
Here are my blueprints.

Looks like you got all the hard stuff done!

From the UE4 docs here: https://docs.unrealengine.com/4.27/en-US/WorkingWithMedia/IntegratingMedia/MediaFramework/HowTo/FileMediaSource/

“Media Player assets by default are set to Play on Open which is why the video automatically starts playing when calling the Open Source function. There are additional commands you can issue to the Media Player asset such as pausing, rewinding or stopping the video once it has begun playing which can be found under the Media Player section when dragging off the Media Player Reference.”

Right now, when you press E, you’re just making the widget visible / not visible. The video will automatically start and continue playing, regardless of widget visibility.

So, to fix this, you simply need to add a function in your widget that plays the media file and another function that rewinds and pauses the video. Then call these functions from your cast to the widget. Hopefully that makes sense.