Language:
Page Info
Skill Level:
Engine Version:
Related Pages

Playing Videos in a Level

If you are looking to have video playing inside your level on an object whether its a TV or a monitor or some other object, you can do so using the Media Framework assets. In this how-to we place a video file inside the Content folder of our project, then use the Media Player and related assets (with a little Blueprint Visual Script) to play the video during gameplay.

For this how-to we are using the Blueprint Third Person Template project with Starter Content enabled. You will also need a Supported Video File saved on our computer that you want to play. You can use your own or Right-click and download this Sample Video .

Steps

  1. In the Content Browser expand the Sources Panel, then under Content create a folder called Movies.

    FileMedia_01.png

  2. Right-click on the Movies folder and select Show in Explorer.

    FileMedia_01b.png

  3. Drag your video file into the Content/Movies folder of your project. Placing your video files inside the Content/Movies folder of your project will ensure the videos are properly packaged.

    FileMedia_02.png

  4. Inside Unreal Engine and your project, Right-click in the Movies folder and under Media select File Media Source.

    FileMedia_03.png

  5. Call the asset SampleVideo, then open it and point the File Path to the location of your video file in the Content/Movies folder.

    FileMedia_04.png

  6. Right-click in the Content Browser then under Media select the Media Player asset.

    FileMedia_05.png

  7. In the Create Media Player window, check Audio output SoundWave asset and Video output Media Texture asset. This will automatically create a Sound Wave and Media Texture asset linked to this Media Player asset which is needed for playback.

    FileMedia_06.png

  8. Name the new Media Player asset. We have called our Media Player asset SampleMedia which is also applied to the Sound Wave and Media Texture.

    FileMedia_07.png

  9. Open the Media Player asset and Double-click on your Media Source asset and it will playback. In the lower-right in the Details panel the Output section will also have auto-assigned the Sound Wave and Media Texture.

    FileMedia_08.png

  10. In the Content Browser under StarterContent/Shapes drag a Shape_Plane into the level. We will use this Static Mesh to playback our video on.

    FileMedia_09.png

  11. Use the Translate (W), Rotation (E) and Scale (R) tools to adjust the mesh similar to below.

    FileMedia_10.png

  12. Hold Ctrl then select both the Sound Wave and Media Texture assets and drop them on top of the Static Mesh in the level. This will automatically create a Material and apply it to the Static Mesh.

    FileMedia_11.png

  13. From the Toolbar, click the Blueprints button and Open Level Blueprint.

    FileMedia_12.png

  14. Add a Variable of the Media Player Reference type called Media Player and set it to your SampleMedia Media Player asset. You may need to Compile before you can assign the Default Value.

    FileMedia_13.png

  15. Hold Ctrl and drag in the MediaPlayer variable and also Right-click and add an Event Begin Play node.

    FileMedia_14.png

  16. Drag off the MediaPlayer variable and use the Open Source node set to your SampleVideo Media Source then connect as shown.

    FileMedia_15.png

  17. Close the Level Blueprint, then Play in the editor.

End Result

When you play in the editor, the video will start playing on the Static Mesh.

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.