currently I want to make effect like Youtube app on Android.
I want setAlpha of SurfaceView when the video has been minimized and is swiping left/right, just like Youtube App did.
but I found when I setAlpha of the RelativeLayout outside the SurfaceView, the whole Video disappear but the Layout is still visiable!
Also I found a same question
Android VideoView.setAlpha is not working (Xoom with 3.0)
can someone help me please?
thx!
Related
I did not use PlatformView when playing videos on Android 4.4, as shown in the following code.
ViewGroup parent = ((ViewGroup) mRegistrar.view().getParent());
parent.addView(surfaceView);
I want to draw some widgets developed with dart on the playback area. If the surfaceview is below the flutterview, the surfaceview cannot be displayed.
As shown in the following code, if you are above the flutterview, the widget on the playback area cannot be displayed. Is there any good solution?
surfaceView.setZOrderMediaOverlay(true);
surfaceView.setZOrderOnTop(true);
parent.bringChildToFront(surfaceView);
You can use TextureView instead of SurfaceView.
I have solved this problem. If you use dart to draw widgets on SurfaceView, not only those widgets need to be transparent, but also FlutterView needs to be transparent so that the content of Surfaceview can be displayed. FlutterView needs to call enableTransparentBackground.
I have a TextureView with a mediaPlayer attached to it, so i can use its surface to display a video, so far it's working well.
Now i try to create a fade in animation for displaying the video and i have no clue of how to do it.
I tried with the setOpaque(false) setting and playing with the alpha setting but it doesn't have any effects.
Also i tried the textureView without a mediaPlayer and i notice that i can't change the background color either, it's always black.
The documentation say that the behaviour of this view is the same as the standard view, but it doesn't seem to be the case.
Does anyone know how to change the transparency of this view ?
Thanks
I also had this problem, and you just need to set setAlpha(0.999f) and it will have transparent background.
I'm creating application with video widget that has fullscreen feature.
My approach is, that I have got main FrameLayout and when I toggle fullscreen I add black background and VideoView widget into this layout.
The problem with my approach is, that change of View structure where is VideoView stored causes MediaPlayer to restart playback, therefore video gets rebuffered - lag in playing.
Possible solution
Create overlay widget/layer, where is video played and resize this overlay to fullscreen or position it over area where should be video played. If I'm not wrong. This won't cause invalidation of canvas, like it is when is videoview moved in view hierarchy. Therefore video should continue play like in new youtube application (android 4.3).
Unfortunately, I'm not Android master, just beginner with Android and this is my first more complex application. So, I can't implement this on my own and I also want to another overlay where is video controller placed and this overlay shall be placed over videoview overlay.
My target: I am trying to play a video when tapping on one of the item on the screen while still staying on that screen.
So I resort to PopupWindow but somehow VideoView doesn't show up in the popup.
I can display popup just fine but the VideoView doesn't(in fact, it's not invisible but rather freeze that section of the screen). If you look at the second and third screen, you will see that the invisible area isn't exactly rectangular. That's because I am animating the popupwindow.
I checked the VideoView itself inside another Activity and it plays nicely. I tested this with Nexus One and Galaxy S, both display the same result.
Quick search on StackOverflow shows this question : android video, hear sound but no video
which leads to
Android not playing Video .mp4
and both doesn't work for me.
Also, as you can see on the third screen, the MediaController doesn't exactly attach itself to the video or popupwindow but the Activity instead.
Here's the screens,
I have an image and a video player. In portrait, it shows both. Doing landscape left, just the video shows. Doing landscape right just the image shows.
I am using the setVisibility() method right now to achieve that. The problem with doing:
myVideoView.setVisibility(View.INVISIBLE);
causes the video to stop playing. Is there a way to keep it playing but also not visible to the user? Maybe like set the opacity of the VideoView to 0?
I think I found a solution here. In order to make videoview invisible and keep it playing sound you simply hide it by setting alpha value.
mVideoView.setAlpha(0f);
Hope it works for you!
You could try changing the z-order of the views with the bringToFront() method.
If you want the video to show then call mVideoView.bringToFront() and when you want the image to show you could use mImageView.bringToFront() this should work as long as the video and the image both occupy the same space on the screen.
Good luck