I have developed a game in Unity for mobile devices and implemented a tutorial video to show how to play. It works properly on iOS but on Android, only a black screen appears. Please note I do not own an Android device – because of this, I am using an Android Studio emulator. Could this cause the problem?
- Unity version: 2020.3.30f1
- Android device API: 31
- Video format: MP4 (tried MOV as well with the same result)
I tried to turn off Multithread rendering as mentioned in one article but this did not help as well. Did my best to pull out some error logs from Android studio but I am still pretty new to this and not sure if this is relevant:
E/BufferQueueProducer: [SurfaceTexture-44-5662-0](id:161e00000002,api:0,p:-1,c:5662) detachBuffer: BufferQueue has no connected producer
Unity does not show any errors with the video and it works properly there.
I can provide more information if needed. Thanks for the help.
2
Answers
In the screenshot you have added in comment, you have attached
VideoPlayer
component on empty game object, and setup it to play it on render texture.We need some way to tell unity to display that render texture data in our scene.
You need to make a
RawImage
and assign the render texture in the texture property of yourRawImage
and attachVideoPlayer
component with same settings.I had the same symptom and I could resolve it by following actions:
Enable "Export for App Bundle" in Unity Project Setting before you export it.
Add following configuration to
build.gradle
in your main App: