4

I have an app that I'm working where in one activity I'm using a VideoView while setting the theme for that activity translucent (transparent) : android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"

However I'm noticing odd behavior from the videoView - for a split second before the video starts playing (it's auto play) the frame where the videoView is itself transparent and you can see the activity behind it. For reference the activity in question has other elements to it and the video is framed.

Is there anyway to make this black or even a custom image that covers the frame before the video starts?

videoView.setBackgroundColor is buggy and actually changes the foreground color and keeps the frame that color while playing...

thanks for your time!

djxstream
  • 565
  • 2
  • 12

3 Answers3

10
videoView.setZOrderOnTop(true);

SurfaceView (and VideoView as subclass) is placed behind the window by default. So you should call: videoView.setZOrderOnTop(true) if you want to place it on top (to make it non transparent).

anonymous
  • 101
  • 1
  • 4
  • > Control whether the surface view's surface is placed on top of its window. Normally it is placed behind the window, to allow it to (for the most part) appear to composite with the views in the hierarchy. By setting this, you cause it to be placed above the window. This means that none of the contents of the window this SurfaceView is in will be visible on top of its surface. > Note that this must be set before the surface view's containing window is attached to the window manager. http://developer.android.com/reference/android/view/SurfaceView.html#setZOrderOnTop%28boolean%29 – anonymous Feb 19 '15 at 04:47
  • while this code block might answer the question please try to improve your answer with relevant explanation. see http://stackoverflow.com/help/how-to-answer – SMR Feb 19 '15 at 04:47
  • SurfaceView (and VideoView as subclass) is placed behind the window by default. So you should call: videoView.setZOrderOnTop(true) if you want to place it on top (to make it non transparent). – anonymous Feb 19 '15 at 04:59
  • @anonymous : It would be better if you post the content in your answer instead of comment. – Sulthan Allaudeen Feb 19 '15 at 10:39
0

You can cover the ViewView with another View and then as soon as video playing starts you can animate this View out, let's say quickly changing its alpha to 0.0.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
0

Please read this response in other SO thread, i think it's the solution for this problem, at least it worked for me

Community
  • 1
  • 1
Hugo
  • 1,662
  • 18
  • 35