
Unreal Engine Blueprint – How to Automatically Remove Video when it finishes playing
INITIAL SET UP:
- You will need a video, media player and widget. If not done so already, please see the blueprint here for setting up a media player and widget
- This overview provides details on how to remove a video from the viewport automatically once its finished playing.
- This blueprint plays a video in a widget in the viewport. To play the video in a TV mesh, please also see the blueprint guide linked to above.
- This overview assumes you have a basic knowledge of blueprint, but if not consider starting with the intro / first blueprint tutorial on this website.
EVENT GRAPH CODE:
- Create a Blueprint and select Actor class.
- Add a collision box and resize as required (you can also map to a key and for this please see details at bottom of post).
MAPPING A KEY TO START THE VIDEO PLAY:
- You can use an on component begin overlap node with the collision box to trigger video play, but I’ve mapped a key to start the video.
- Add the key at the start – E or P for example.
- Drag off from the key and add a Disable Input node.
- Connect this to Get player character and a Get Player Controller – so the player can’t move when the video plays.
- Then add an ‘Open Source’ and select the required video.
- Drag off from the Open Source exec pin and add a Create Widget > Select the widget you created for this in the drop-down list.
- Next add a ‘Add to Viewport.’
MEDIA PLAYER:
- Create a variable and name it media player.
- In its type > search for ‘Media Player’ and it should be the object reference type.
- Drag in the node and connect to ‘Target’ of Open Source.
- Press compile and make sure that the required media player is selected in the media player node details panel (this will appear when node selected).
- Drag off from Media player and add a ‘Get Duration.’
FINISHING OFF:
- Add a Delay at about 0.2 – NOTE: The blueprint will not work if this isn’t added as no video will be playing when it goes to Set Duration.
- Add another Variable and search for ‘Timespan’ and call it ‘MediaDuration’Â
- Drag this new node into the graph and select Set Media Duration
- Hover over the Media Duration right-side socket and right click > Select Split Struck Pin
- Then Drag off from ‘Seconds’ and connect with another Delay (as shown below).
- The rest of the blueprint removes the widget when it’s finished playing and enables the input again.
Please see the finished graph below in full
- AS NOTED ABOVE: I’ve used an interface (that I named Interact (The red node below)) to connect the E key directly from the 3rd person character. Hence, I haven’t added an E or P key directly. To add a key directly in the blueprint please see the instructions here.
Related Video Blueprint Tutorials
This overview tutorial is part of a specific set of tutorials that relate to the upload and playing of video in Unreal Engine. Please see below the related posts in this series.
-
-
-
How to Automatically Remove Video when it finishes playing.
-
Video Tutorial
For further tutorials on blueprints please see the page here: Blueprint Tutorials or to get started with blueprints please see here: Get Started with Blueprint
Leave a Comment
Subscribe to Newsletter
Motion Forge Pictures Blog
Featured Posts and Links
Free Height Maps
Free 3rd Person Animations
Free Store Downloads
Unreal Engine - Free Materials
Latest Posts
103, 2025
2702, 2025
2502, 2025
1902, 2025
1802, 2025
Categories
Tags
achieve (2)
ambient (3)
animation (18)
animation and filmmaking (17)
animation reference (2)
arch viz (5)
background video (3)
blender (24)
blueprint (12)
blueprints (13)
cinema (3)
cinematic (4)
cinematics (10)
davinci-resolve (3)
download (4)
film (2)
free (15)
free download (32)
ghosts (5)
ghost story (3)
haunting (2)
height map (3)
height maps (3)
history (4)
Info and Insights (36)
landscape (11)
landscape height maps (6)
low poly (4)
materials (3)
maya (3)
meetup (2)
modeling (3)
mystery (2)
quick tip (3)
ratio (3)
relax (3)
Resources and info (5)
speed design (3)
sports car (3)
substance painter (6)
terrain (5)
tutorial (2)
unreal engine (39)
unreal engine 5 (3)
video (3)