- Home /
Can I add a surfaceView to my UnityPlayer
I want to use a surface view to play a video with a mediaPlayer. I finally figured out how to do plugins, I can get an image to show up via plugin, now I'm trying to show a surfaceView at the bottom or top of my application (it doesnt matter) to play a video from my sd card.
The problem that shows up is
W/SampleTable( 76): Table of sync samples is empty or has only a single entry!
I/OMXCodec( 76): [OMX.SEC.AVC.Decoder] allocating 5 buffers of size 65536 on input port
I/OMXCodec( 76): [OMX.SEC.AVC.Decoder] allocating 2 buffers of size 61440 on output port
and my video does not play. No other errors or anything show up just that little piece.
Can anyone help? I will try to work on this I just want to know if I can use a surfaceView ontop of my Regular UnityPlayer Activity (eg call Activity.addContentView(...))
Thanks.
I never tried something like that, but what i can say is that you should give some more details. Especially:
What build target / platform
What file do you want to play
What plugin do you use.
Build Target is the Android device
I want to play a .mp4 file
The plugin is one i created myself. It adds the SurfaceView using Activity.addContentView(surfaceView, layoutparams) and i know that works because the surface view shows up (i turn the surface views background red) but the video cannot play i get the above error, and on Prepared is never called (I'm using media player as my videoPlayer).
Also the in my question above I have found is shown each time a media player gets data and decodes it to play (at the beginning only) so it is not an error like I thought
Answer by Raigex · Jul 16, 2012 at 02:49 PM
I found what the problem was. My video was playing. I just couldn't see it. When i built my plugin I did not know that UnityPlayer uses a SurfaceView (or something similar) so I needed to set the function surfaceView.setZOrderMediaOverlay(boolean) to true. This places the video above the unity player but below the window. It now works.
Answer by robertandriessen · Feb 15 at 01:34 PM
Can I please ask how you built that surfaceview to play video in the bottom layer below the ui? I have been trying to figure it out as it seems the only way to access native video playback. @Raigex
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Kindle Fire Video Streaming Crash 0 Answers
Record a video in unity on mobile (Android, IOS) 1 Answer
Develop for iOS/Android using Windows PC 3 Answers
Camera Recording for Unity 3D 0 Answers