My application has several pages of book. In some of page I am playing video using video view. I am checking if I have any video for that page. If yes, than I am making videoview visible and passing Uri. If not, I am making it gone.
Now the problem is, once i reached to that screen and then if I swipe left/right it's creating black window in every subsequent screen. Why?
I found solution. When you want to show video make videoView.setZOrderOnTop(false); and when you want to hide video view jusr make videoView.setZOrderOnTop(true);
Related
I'm using YouTubePlayerView of YouTube Android Player API. I just want to get the center view of the video like this:
Is there anyway to do that ?
You can't crop a video while playing via the android youtube-player-api. You also can't hide any part of the video by overlaying another view on top of it or the player will throw UNAUTHORIZED_OVERLAY Error.
So if you ever try to hide the player by putting a View or two on either side then you can't. However there is one way to cover the YouTubePlayerView: Dialog and DialogFragment, you can put up either a Dialog or DialogFragment add some views and cover the video partially to give that special crop effect. From these two IMO DialogFragment is the better choice (you may feel differently).
Another way to crop the video would require complete change of player on your part. You'd have to switch to a WebView based player i.e. play your videos in a literal browser (there are lots of WebView-based players available on github). A WebView unlike YoutubePlayerView or YoutubePlayerFragment will not throw the nasty UNAUTHORIZED_OVERLAY Error. However you will see ads and the default player controls while the video is being loaded. I guess you might be able to hide the WebView or overlay another view on top of it while the video is loading and use the YouTube Data API to put a thumbnail on top, but I've never tried it.
Hi I am developing small android application in which I want to display some textual information over my video view same like youtube showing text content over the video and user can close that content.I am bit confuse to decide which approach I should take. Either use surfaceview or user video view Or user some custom video view with extended class. Ot just include text view with overlay on top of video view. Any one here already implemented this king of stuff can please help me to sort this situation. Need some help. Thank you.
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!
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).
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.
Please read this response in other SO thread, i think it's the solution for this problem, at least it worked for me
I have a viewpager which has two views in it. On the first view I have a list of videos and on the other one I play the video.
The issue is when I play the video on the second view and if I want to go back to the first view, there is a black rectangle remaining from the video. it disappears after a few seconds.
I am using a galaxy note running ICS.
Can it be because of memory usage?
Thanks,
I solved this problem long time ago by setting background color of the videoview to some color and then making it '0' onVideoPrepared().
Well, do you "stop()" the video when you start dragging the page ?
if not, then you need to add a OnPageChangeListener to the viewpager, so when you start scrolling/dragging the page, you stop the videoview, that should fix your problem,
the more probable thing is that for optimization reasons does not want to be playing the video as dragging the page so puts a "picture" of the video while moving.
I have a webview that's playing a video, and I want it to appear behind some other views, but I can't seem to make it happen. I've tried simply just sending the foreground views to the front with bringChildToFront(View v), but no cigar. Any thoughts?
Edit: Some more details: The webview plays a video using flash, and the webview is the size of the entire screen. I have some stuff I want to pop up in front of the video, but they only stay behind the video. They're definitely there, as they receive touch events and stuff, but just hidden away from view by the video.
Since the Flash player will essentially pre-empt any other views in the window, you'll just have to do one better over Flash: use another window on top of the main window.
Android allows you to do this by using the PopupWindow class.