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

Streaming Videos in a Level

Choose your OS:

In this how-to we play a video on a Static Mesh inside the level when we start the game. Our source video will come from a provided URL stream and we use some Blueprint Visual Script to open the stream and start playback once we load into the level. The end result is a video playing inside our level where the source comes from our assigned URL similar to below.

Steps

For this how-to we are using the Blueprint Third Person Template project with Starter Content enabled.

  1. In the Content Browser expand the Sources Panel then create a new folder called Media inside the Content folder.

    StreamMedia_01.png

  2. Click the Add New button, then under Media, select Stream Media Source and name the asset MediaStream.

    StreamMedia_02.png

  3. Open MediaStream then enter your desired Stream URL.

    StreamMedia_03.png

    If you do not have a URL file to link to, Right-click this Sample Video and copy the link address and paste it in the Stream URL field.

    Your Stream URL must link directly to a supported format in order to play back the video. For example, PS4Media (PS4) only supports MP4 through HLS right now, while WmfMedia (Windows) can support a number of other stream sources. For futher information on supported formats per platform/player plug-in, see the Media Framework Technical Reference page.

  4. Click the Add New button, then under Media, select the Media Player asset.

    StreamMedia_04.png

  5. In the Create Media Player window, check Audio output SoundWave asset and Video output Media Texture asset.

    StreamMedia_05.png

    This will automatically create a Sound Wave and Media Texture asset linked to this Media Player asset which is needed for playback.

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

    StreamMedia_06.png

  7. 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.

    StreamMedia_07.png

  8. Use the Translate (W), Rotation (E) and Scale (R) tools to adjust the mesh to your desired size and location.

  9. Hold Ctrl then select both the Sound Wave and Media Texture assets and drop them on top of the Static Mesh in the level.

    StreamMedia_08.png

    This will automatically create a Material and apply it to the Static Mesh.

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

    StreamMedia_09.png

  11. Add a Variable of the Media Player Reference type called Media Player and set it to your SampleStream Media Player asset.

    StreamMedia_10.png

    You may need to Compile before you can assign the Default Value.

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

    StreamMedia_11.png

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

    StreamMedia_12.png

  14. 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.

Similar to using a File Media Source which plays a video file from disk, Stream Media Sources will automatically play when calling Open Source if their associated Media Player asset are set to Play on Open which by default is enabled. 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.