How can I play a .mp4 movie file during the game?

I’m not seeing many examples or detailed documentation on how this should be used, though I do see code references. I’m trying to play a .mp4 file (h.264) at some arbitrary point in my game using calls like this:

FLoadingScreenAttributes movieAttributes;
movieAttributes.MoviePaths.Add("Test1");

TSharedPtr<IGameMoviePlayer> moviePlayer = GetMoviePlayer();
moviePlayer->SetupLoadingScreen(movieAttributes);
moviePlayer->PlayMovie();

Stepping through the code shows that it’s finding my test movie file correctly. However, all I see is a flash of white on-screen momentarily. The movie appears to stop immediately because, in WindowsMovieStreamer.cpp, the FVideoPlayer::Invoke() function is called ultimately with an event of type “MEError”, thus calling MovieIsFinished.Set(1);

Is my usage correct? Is this sort of thing supported? Thanks!

In UDK we would convert a MP4 to a BIK using Radtools.
I don’t know if that’s still required.

You should call this, by default it’s set to true so when u play the movie it’s detected u already complete load level and skip the movie.

movieAttributes.bAutoCompleteWhenLoadingCompletes = false;

You also can add this to press any key to skip the movie

movieAttributes.bMoviesAreSkippable = true;

Thanks for your reply… I tried this, but it didn’t seem to have an effect. The screen just flashes white for a frame and I get the same Windows error event ‘MEError’ in FVideoPlayer::Invoke().

Do you build and play the game from the build ? coz play in editor and launch game from editor it will skip the movie.

Yup, I play from the build as opposed to through the editor (I’m getting a valid and “real” movie player pointer, not the dummy one).

I’m not sure what the problem then.
In my case, i make a module follow Loading Module from Shooter Game example. Put mp4 movie in Content/Movies, add the same code then run at beginning of game.
U can try this code of mine, just simple one for test.
Loading script is in LoadingScreen.

link text

btw add this to .uproject file

{
	"FileVersion": 3,
	"Version": 0,
	"VersionName": "0.0",
	"EngineVersion": "4.0.2-2034640+++depot+UE4-Releases+4.0",
	"PackageFileUE4Version": 342,
	"PackageFileLicenseeUE4Version": 0,
	"FriendlyName": "",
	"Description": "",
	"Category": "",
	"CreatedBy": "",
	"CreatedByURL": "",
	"Modules": [
		{
			"Name": "IntroLoading",
			"Type": "Runtime",
			"LoadingPhase": "Default"
		},
		{
			"Name": "LoadingScreen",
			"Type": "Runtime",
			"LoadingPhase": "PreLoadingScreen"
		}
	],
	"EpicSampleNameHash": "0"
}

come on man… marked for study.

Hello, epark. Once you have a to try the answer provided, if it takes care of the problem you were experiencing, just click the checkmark next to the answer to indicate that answer took care of your problem and it has been resolved (it doesn’t hurt to upvote the answer as well). If it doesn’t take care of your problem, just comment again with any new information you may have.

Have a great day.

Thanks for your replies. I didn’t have a to try the latest suggestion and won’t be able to for a few more days, unfortunately. I’m new to this; how should I mark this?

Hello, I tried your solution out: creating a new gameplay module to play an intro movie, though I’m unsure if this is necessary. I’m still having no luck. Though I’ve noticed that since the 4.1 update, the screen flashes black now instead of white. Could there be some other fundamental issue I’m missing?

As an aside - Is this functionality only meant to apply to intro/loading movies? In my particular scenario I’d like this to play at some arbitrary point in the game, not just in intros (though as I said, I did try your solution as described as an intro movie, fired from BeginPlay() on the game mode).

Oh, ok. Then i’m not sure what the error also.
In my case i just need to load the movie for intro and between loading level only so you see this “LoadingPhase”: “PreLoadingScreen” in .uproject config.
And I haven’t try play movie in game yet, so i’m not sure this method can be used or not.
Srr can not help much.