Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Vuforia video black screen #18

Closed
ianrothmann opened this issue Feb 13, 2018 · 7 comments
Closed

Android: Vuforia video black screen #18

ianrothmann opened this issue Feb 13, 2018 · 7 comments

Comments

@ianrothmann
Copy link

Hi there,

We have a Vuforia marker with a video that plays when the marker is scanned. The video is included in the Unity project. The video just appears black on Android devices and eventually crashes the unity part of the app. We've got other markers that display 3D assets too and they work perfectly fine on Android.

If we only run the Unity project separately the video works on Android, so this only happens when the project is integrated.

Everything is fine on iOS.

We've tried removing the multi-threaded rendering and transcoding the videos (and the override for android option). We also tried vp8 and h.264 codecs (specified in Unity).

We've been battling with this for 2 solid days and I'm out of ideas.

Do you perhaps have a clue of what could be the problem?

Kind regards,

Ian

@yasirkula
Copy link
Owner

In our project, we have also used VideoPlayer to play a video on a marker. We were using asset bundles but we had to do a workaround because VideoPlayer didn't support playing VideoClip's from asset bundles back then. What we did was changing the extension of the video asset to ".bytes" and referencing it from our script with a TextAsset variable. Then, when the scene starts, we temporarily save the video to the local file system:

string path = Path.Combine( Application.temporaryCachePath, "temp.mp4" );
File.WriteAllBytes( path, videoClipTextAsset.bytes );

Afterwards, we tell the video player to play the video at that path:

videoPlayer.url = path;
videoPlayer.source = VideoSource.Url;

In conclusion, we played videos from url rather than from VideoClip assets.

@yasirkula
Copy link
Owner

I can't remember whether it was videoPlayer.url = path; or videoPlayer.url = "file://" + path; though.

@ianrothmann
Copy link
Author

Thank you very much, we'll try this today. I will post whether it solves the problem.

@ianrothmann
Copy link
Author

It works like a charm! :) Thank you very much!

@RyuuYuki
Copy link

I solved this problem.
Put in the video folder in StreamingAssets/Ionic.mp4
After export, the video will be in the folder assets/Ionic.mp4
You can specify the path for the android with the following code:

videoPlayer.url = "jar:file://" + Application.dataPath + "!/assets/Ionic.mp4" ;

@erickcouto
Copy link

I'm still getting this error. My app just crash when the video start. Can you help me?

@yasirkula
Copy link
Owner

Are there any error messages in logcat/Xcode console?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants