Exclude view from blurring android - android

I am having a VideoView in my application.
I have set blur flags in my activity
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
The problem is even the video in the VideoView is blurring, which I don't want.
When VideoView is replaced by an ImageView with a specified source, its not blurry at all.
Is there any solution to avoid this blur in VideoView?

That's because a VideoView creates a surface behind your application's surface. The FLAG_BLUR_BEHIND flag blurs all the surfaces under your application's surface. This is why the ImageView is not blurry because it is in your application's surface, not in a surface behind it.

Related

How to flip(mirror effect) a video in a VideoView?

I know there are ways using TextureViews and some other ways, but can we do a video flip in a VideoView, I tried using the method scaleType of X axis to -1, but just getting a black screen. Is there no way to do a simple video flip for a video being played in a videoview? Am I forced to use a TextureView or other methods?
As you said, the best option is to use TextureView... Android's VideoView can only play videos straight and not mirrored.
If you want your app to play a video mirrored (for instance if the video was recorded using a front camera), you will need to use a TextureView, which can be easily mirrored by specifying android:scaleX=-1 in the XML file, or textureView.setScaleX(-1) in the code. (source)

Android RenderScript to blur video in VideoView

I know that I can use RenderScript on Android to blur images, but does anybody know if I can apply the same to video views so that my complete video is gaussian blurred?
VideoView, which extends SurfaceView, does not utilize the drawing cache due to being hardware accelerated. This means you won't be able to get stills. I was forced to scrap the design I had using the paused video still.
Check out: VideoView getDrawingCache is returning black
Edit: As I look into this more, there might be a way through https://github.com/google/grafika, but I haven't seen anyone verify it as a performant workaround.
You should use a thumbnail of the video in front of it. You can then, blur the image using this lib: https://github.com/jrvansuita/GaussianBlur

How to hide video in a surfaceview and keep audio playing

I am using a mediaplayer on surfaceview and playing a video file. I dont want the video to be displayed but audio must be audible. Seen some of the questions and tried them, no help. Somebody please help.
Use a RelativeLayout and put an ImageView (with match_parent for width and height) above the SurfaceView in your layout. Set the source for the ImageView to a thumbnail and let the video play behind it (but not visible to the user).

Scale vitamio with surfaceview

I am using Vitamio media player to play RTMP stream onto a SurfaceView, everything is fine but the video size is smaller than the screen. I am looking for a way to scale the video to fit the entire screen. I set the SurfaceHolder to the fixed size of my Nexus4 display (1280*720) and the video received is (950*640).
I tried overriding onDraw but no results.
I am trying now to override unlockCanvasAndPost function of SurfaceHolder, so I can scale the canvas, but don't know exactly how to achieve this.
Also, maybe there are related AVoptions I can pass to the player?
You can scale the video surface, VitamioDemo have a sample, https://github.com/yixia/VitamioBundle/blob/master/vitamio-sample/src/io/vov/vitamio/demo/VideoViewSubtitle.java

Issue displaying thumbnail image in VideoView

I'm using VideoView for a web video, and I also have a bitmap object contains the corresponding thumbnail image. Now how should I set the bitmap to the VideoView for displaying the thumnail?
I'm using
videoView.setBackgroundDrawable(new BitmapDrawable(getResources(), bitmap));
But then when I play this video, the video doesn't show, instead it always show this static thumbnail image.
Any hints would be appreciated. Thanks.
VideoView is a subclass of SurfaceView, which has some special behaviors in terms of its display. SurfaceView contents are actually drawn in a window underneath the view hierarchy and the view simply acts as a hole in the current window so the contents are visible. Because of this, if you apply anything to the view itself (like a background), it will actually be Z-Ordered on top of the video content. In addition, if you place anything underneath the VideoView, it also will not be visible because of this "hole".
If you want to display content in this space while the video is not playing, it will either need to be in a separate View laid out on top of the VideoView that you can hide/show when the video playback state changes, or you need to set/clear the background image you have set when the video playback state changes.
HTH!
Use this code
BitmapDrawable bitmapDrawable = new BitmapDrawable(bitmapImage);
videoview.setBackgroundDrawable(bitmapDrawable);
videoview.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
videoview.setBackgroundDrawable(null);
}
});

Categories

Resources