Dynamic Video playback in UE4.6

HI All,

I am trying to achieve video playback in UE4.6 by selecting files dynamically (in game). Upon some research, I got to know that Media Textures can be used for the same. However, I could not find out how to do this using C++ code as I felt it is the only way to achieve this. My plan is to write a function which does the following steps: 1. Create the media texture out of a .wmv file. 2. Add the media texture to a wall/cube. 3. Start the playback so that the video can be seen on the wall/box.

Please clarify if something is wrong in my thought process. Can you provide some sample code / commands which can be used to achieve this?

I would do it this way:

  1. Create a MediaPlayer object in the ContentBrowser
  2. Create a MediaTexture from the MediaPlayer
  3. Place the MediaTexture on the wall in your level

You can then control the MediaPlayer from both C++ and Blueprints; this includes loading and playing the movies. You can find all available C++ functions in the MediaPlayer.h file. Those that are annotated with the UFUNCTION() macro are also available in Blueprints. Simply enter ‘media’ as the filter when creating new Blueprint functions, and it will give you a list of all the available functions. You can then hook those up to your MediaPlayer object by creating a MediaPlayer Blueprint variable and assigning your MediaPlayer as its value.

Hi,

Thanks. The steps that you have provided is also shown on a video on youtube. However, the requirement is slightly different. I would like to do the below things while in game.

  1. load the movie files present in a particular location on windows and list them on the screen for user to select.
  2. provide a user input to select one of movies.
  3. Load the selected movie and play it on a wall

As I have mentioned above, these steps need to be run during the game and as I am not sure of the movie to be played out before playing the game.

Also, I am not able to find the media functions in any blueprint. Can you please be more specific on how to get the media functions in blueprints for usage? I would like to play, pause, stop, seek the playback as a node property from blueprint.

Hi,

To open a video file, I must use mediaplayer->openurl right? I am finding that mediaplayer->openurl always returns false. How must the url be given as argument to openurl? Please help.

what is the URL you’re passing? false means that the file either couldn’t be found, or that the video format is not supported.

Hi,

I had one more query. When I apply the material to a cube or a wall, I see that the video is played through all faces of the cube. How can I get it to play on only one face of the cube? Please help.

see my reply in the other thread