Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Raigex · Jul 13, 2012 at 09:46 PM · androidvideo

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.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Jul 13, 2012 at 10:42 PM 0
Share

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.

avatar image Raigex · Jul 14, 2012 at 12:53 AM 0
Share

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image baozi · Jul 18, 2013 at 01:08 AM 1
Share

This saved my life. Thank you.

avatar image
0

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Kindle Fire Video Streaming Crash 0 Answers

Android Action Button 2 Answers

Convert Input.getaxis Input to Android controls 0 Answers

Animated Gif 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges