Play / pause MediaPlayer video in Blueprints for Gear VR

EDIT: I noticed the problem is not in the “setMaterial” part, but in the “pause” and “play” parts. See the UPDATE part below for more info. Because of this, I’m changing the title as well.


So, I’m developing for Gear VR. Basically I have a TV screen playing a video with a MediaPlayer, and 3 buttons in front of it. Clicking one of the buttons have to switch between 3 videos.

I’m a newbie with Unreal Engine, so I don’t know if there is a better way to do this, anyway this is what I came up with:

Basically I have 3 materials with 3 different MediaPlayers. Each time the user clicks one of the buttons, I pause all the players, then I change the material of the tv screen, and then I start the associated media player.
Also, The Level Blueprint ensures that when I BeginPlay the video number 1 is played automatically.

This BP is working as expected when I play it in the Viewport Editor, but when I package and install it in GearVR, only movie number one works correctly (the one that is played at begin). If I try to switch to movie 2 or 3, I get a black screen; If I switch back to movie 1, it works correctly. I can see the prints, so the functions are called.
I suppose it is all due to [Gear VR limitations][2], but I cannot understand what is the problem there. All the materials are quite standards (a MediaPlayer texture connected to Base Color and Emissive joints with an Opaque Blend Mode).


UPDATE: I tried removing the “play” part in the blueprint, and stopping the flow after the three “pauses”.
The pause part works in the editor: the video pauses, and of course the material is not changed and the new video is not started.

But when I tried to pack it and install on Gear VR… the pause part didn’t work anymore.

So, what actually happened before is that the mediaplayer is NOT pausing, the setMaterial IS actually setting a new material, and the new video is NOT starting. So I get a black screen.

So… my question is now: why the “pause” and “play” parts are not working on GearVR, while they work in the editor?

Terribly sorry to hijack your question but I’ve been having trouble with encoding video for Gear VR.
Would you be willing to share what software, video codecs, settings and resolution you used?

Thank you very much!

Odd, I thought Unreal Engine 4 had a known bug with H264 encoding.
I don’t need to stream the video, I’m fine packing it with the APK. I tried using a 1024x1024 but the performance was horrible. Gear VR limits seem a lot stricter than plain Android.
I only know of Cam Studio for recording.

Thank you for your help!

Sure, no problem! :wink: keep in mind that GearVR => Android, so here you’ll find all the informations you need: [][1]
I ended up putting a mp4 file with H264 encoding on a private server, then copypasting the complete url in my media player asset. The rest of it is fairly standard. The video won’t play in the standard viewport (you’ll see a black screen), but it will work on device.

[1]:

Ok, it turned out that it was a bug with the “Pause” block. I followed the suggestion of Chris Babcock here and started using the UE4.11 Preview. With the new code, the problem is gone.

Hm, not sure about the H264 bug, maybe it was in the older versions. Yes, GearVR has a whole lot of painful limitations, you can find them in the docs. I think that the 1024x1024 size suggestion was for the Textures, not for the videos. I’m streaming a standard 1080p video and I’m getting 40 fps (if you pack the video with the apk is easier, of course). I didn’t try to record yet, so I cannot help you with that.

You’re welcome!

I mean I use Cam Studio for making(encoding? I don’t know right word) video data I want to play back on Gear VR. Sorry for confusing words. I cannot afford Adobe After Effect. Virtual Dub seems promising, do you use it?

I have seen the limitations. 2048 x 2048 is the max texture size for Gear VR. Smaller is better.
The documents do not describe possible resolutions for video and questions on making video data that works on GearVR go unanswered:

I’m really at a loss.
If you’d prefer to communicate privately, please message me on forums:
https://forums.unrealengine.com/member.php?10569-haruna

I really cannot help you with video editing software, I’m sorry. I tested it with some ordinary videos, recorded with the phone camera. I suggest you to search on Google for “Cam Studio settings for Android” or something like that.

I don’t think there are limitations for video resolution or framerate. Of course, the smaller the better.

Don’t worry, I have no problem keeping talking here; although we’re going a little OT, these informations could be useful for others :wink:

Sorry for the late reply.
Thank you VERY much for the assistance!

I have an iPhone so I doubt video I record on my phone would work. I’m making original animations in a 2D art program so I need to convert them to a compatible video format.

I’m sure I’m not the only person trying to put original animation video into gear VR!