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

Why is the Unity Video Player not working? #77

Closed
ambisign-gavin opened this issue Dec 22, 2018 · 6 comments
Closed

Why is the Unity Video Player not working? #77

ambisign-gavin opened this issue Dec 22, 2018 · 6 comments

Comments

@ambisign-gavin
Copy link

I need to use Vuforia to play a video when I found a specific target. And my implement way was attaching VideoPlayer to a Plane object.
But for now, the Plane attached by VideoPlayer is always a blank, nothing showed.

I alos tried to use the normal Unity project to implement the VideoPlayer, but it is still showing blank.
unityvideoplayer

However, it works if I use Unity to build and run apk ,not by react-native .
screenshot_2018-12-22-23-12-45

Does anyone have this problem before?
I will be grateful for any help you can provide. Thank you!

@f111fei
Copy link
Owner

f111fei commented Dec 24, 2018

Check whether there is an error console.
Video components are also used in my project, but it's work.

@ambisign-gavin
Copy link
Author

ambisign-gavin commented Dec 24, 2018

Thanks for replying soon. But I didn't see any error in my console.
Did you change any build settings to your project?

P.S. I tested it on Android.

@JanOwiesniak
Copy link

My project is based on the demo repo as well and i have worked with the default Unity video components without any problems. Does the video work if you export it as „stand-alone“ XCode / Android Project through the default Build Settings?

@ambisign-gavin
Copy link
Author

ambisign-gavin commented Dec 25, 2018

@JanOwiesniak thanks for your reply.

I have tried many video types, including WebM, MP4, and MOV.

All videos I've tried were played successfully when I exported my Unity project alone with default settings and built it through Android Studio.

But only two videos were played successfully when I built the Unity project as AAR, and imported it to my Android Studio project, or used react-native-unity-view.

One of the successful video format and codec is MOV and H.264 High, and the other one is WebM and VP8. But the weird thing is I have these two formats and codecs in those fail videos too.

That very confuses me, maybe Unity project has different video support rule when it used as a Library?

@JanOwiesniak
Copy link

Hm, i tested the default packages only with mp4 files and had no problems. Recently i switched to this package which offers support for many different file formats out of the box and is highly configurable. You could give it a try.

@ambisign-gavin
Copy link
Author

Finally, I fixed this problem by add aaptOptions in my build.gradle

android {
    ....
    ....
    aaptOptions {
        noCompress '.unity3d', '.ress', '.resource', '.obb'
    }
    ....
}

And I found a note in Unity docs

Playback from asset bundles is only supported for uncompressed bundles, read directly from disk.

that may be related to this problem, but still can't answer me why some videos can be played, and others can't.

@JanOwiesniak I've tried the AVPro Video package, which is very powerful. I will use it if I need more video features.

Thanks for your help.

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

3 participants