I’m using 4.13 and can’t figure out a way to play video in android device. I have coded all the stuff and video plays perfectly in editor. But I see jus black on the device when exported.
I’m very much confused searching about it cuz most of the questions or references are on old engine versions and are no longer relevant. Here are things I’ve done:
got a mp4 video with H.264 video codec, created a ‘Movies’ folder in Content folder of the project and dropped the video in it.(No media player or media source file was created automatically when opened editor)
As video wasn’t showing in editor, I drag and dropped the video file in empty movies folder shown in editor. That created a media source file, Double checked the location was relative
created a playlist as well as a media player. Created a media texture, Made a material out of it. Material Domain was changed to UI for proper running of video.
Applied the material to an image in UI widget used to show the video.
Works in editor not in Packaged game. Have no idea what codec are supported as there are lots of redundant answers online.
I have successfully been able to add a video on a packaged APK. Could you please upload screenshots of how you set up your project, or zip your sample project and provide it to me to review.
A very silly one … my map gets loaded and I even spawn couple of dudes around … but after spawning enemies tutorial is played but it shows only black images. I can wander and play my game as normal. No issues for that
Move the .mp4 file to Content/Movies/Movie.mp4 and then open up your NewMediaPlayer and right-click on the video and select “edit”. Once you’ve done that, a new window should pop up. All you should need to do now is click on the (…) or add ./Movies/Movie.mp4 after it’s been added to your Content/Movies folder.
Hi
I’ve tried what you have suggested. But it seems you are on 4.14 preview or something. because the steps aren’t working on my end and UI looks slightly different in your images. I did exactly what you said:
The .mp4 file is in Movies folder
Opened the player and right-clicked and clicked ‘edit’ to the video.
It jus opened the generic asset editor - File media source(the very 1st image in the above image grid I sent). It was already set to ./Movies/vid.mp4 but still edited that again in case its was a bug or something.
Please check the image I sent again. Procedure you sent is not working
I tried ‘Open URL’ to play the video and entered ./Movies/Myvid.mp4 as URL … It failed to open. Even tried packaging. Not working
Move your .mp4 to a folder you make yourself which is called ‘Movies’ and place it in the ‘Content’ folder
Once you’ve done that, open up your NewMediaPlayer and right-click on the video and select ‘edit’
A new window will pop up, click on the ellipses and add the video that’s located in your Movies folder
Please double check your NewMediaTexture_Mat and make sure that the video is showing up on the material and is referenced from the right place. Check your texture too, and make sure it’s referenced from the right location too. In the viewport, you should be able to see the video playing.
the vid is still isn’t playing
I tried what you said in the above reply, I triple checked these :
location of media file when I click on edit after right clicking the video in media player.(vid is in Movies folder which is in Content folder of project)
the dependencies of media texture and made sure the same texture is used by the material.
Though I found a very odd thing. When I tried to print the URL after the media is opened (by binding the function as in your previous screenshot), it messed up my other bindings.(only on device, runs good in editor).
I have custom events in a HUD which I bind to initialize stuff of my NPCs after I finish some UI interactions. If I bind the ‘On media open’ event to a custom event, my other bindings are ignored ! it messes my AIs (ignore it if I haven’t explained it properly :P)
So, when I print the URL, it shows correctly on PC, saying :
file D:/my /‘SomeFolders’/MyProject/Content/Movies/Vid.mp4
but when I print it on device it says something like this :
file /…/…/…/MyProject/Content/./Movies/Vid.mp4
(the above address is exactly what is shown, Dots NOT for representing long address) I guess the problem is because of that one dot before ‘/Movies’
I’m currently using 4.13.0. I’ll try this again after I update to 4.13.2.
Would have made a video to show and explain clearly but it takes too much time to recode the mess the binding does.(delete every reference and reconnect it and stuff). If those dots appear due to absence of that location, I might have no option but to upgrade the engine at first place
Once you’ve upgraded your engine, please let me know whether or not this is working for you. I have tested this thoroughly and haven’t ran into any issues but I am on 4.13.2.
I’ve upgraded the engine and did same thing on a blank project. The address error still persists. It takes ‘___/Content/./Movies/vid.mp4’ even when I exclusively select the file by right clicking the media from the player. Runs great on PC but when ran tests on Asus Z00LD(ZE550KL) and an Oneplus One A001, the media address got messed.
Do I have to check my SDK updates from Nvidia Gameworks or something ?
And I noticed that the screenshots u sent had like yellow edit button but in my 4.13.2 there was a regular one. Is it because of GitHub version or something ? Or u might have jus edited the pic highlighting that text
I’ll send u the blank project soon as my internet is bit slow.
Please upload a sample project that’s set up exactly like you have it in your project so that I can test it on my end. I just ran another test and my mp4 videos are working perfectly fine in 4.13.2.
The edit button is yellow because I highlighted it for you.
Thank you for submitting a bug report. I have reproduced this issue and logged a report for it here [UE-38598][1]. You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.
is there any way to hack through it for now ? like changing the URL or something ? otherwise i’ll just go for static image tutorials or will try image sprites for my game … Thanx for listening to me for so long love u guys
I see the bug description [UE-38598][1] being pretty vague so I’d like to share my experience if it can shine more lights on the issue.
I’m trying to play a video on an Samsung S6 SM-G920P, using 4.14.
It all works fine (with the MediaPlayer14.java from 4.15 branch to fix the media texture not being flushed properly) up to a certain packaging size.
For exemple I have a 90MB, I can play it on device no problem. I add into the same package 2 other videos of 350MB and 190MB and suddenly the 90MB video doesn’t play anymore.
the log gives the error “LogAndroidMedia:Warning: Failed to set data source for asset […]” which happens on :
JavaMediaPlayer->SetDataSource(PlatformFile.GetAssetManager(), FileRootPath, FileOffset, FileSize)
When the same non-working build is put on an S7, with better hardware (more RAM I would suspect is helping), it works and load any of videos packaged ! well, at least most of the time - it still fails every now and then.
This makes me think the asset manager is struggling when the package on android become too big to gather the blob data for a video within that blob properly.
oh yes I am all data packed into one apk, not using obb file -
I don’t know for sure if it’s related with XADIFY problems since many things can make the movie texture go black (like bad encoding) but if his package is big, I would put a penny on facing the same issue.