I have to create a circular video player using textureview in android. I don't have idea how to achieve this. Kindly help.
It's possible to modify the Camera output as you record it, but this has nothing to do with TextureView. You can use a GLES fragment shader or apply a mask bitmap with GLES. Grafika ( github.com/google/grafika ) has some relevant code, but doesn't do what you're specifically asking for
You can achieve by providing overlay of TextureView
here is sample how you can achieve!
Related
According to this answer in the update #2 section is there any way to provide the Surface from glSurfaceview to the MediaRecorder?
Or it has to implement from the SurfaceView like in the RecordableSurfaceView which use MediaRecorder and in the grafika which use MediaCodec?
Update:
After do some more searching I found this which may be the answer. By the way as I have said in the title, I only need to record the rendered glSurfaceView so I'm still open to any suggestion that helps me achieve it.
Another good reference
I'm trying to find simple examples of using OpenGL with Camera preview. Help me with code examples.
Luxand FaceSDK contains samples for Android using OpenGL to draw image from camera - you can look at the code.
What is the best way for Camera Live filters. I am recently using GPUImage Library from Link: https://github.com/CyberAgent/android-gpuimagelibrary.
Than I have found SurfaceView and GLSurfaceView.
Problem is:
How to apply live filter to camera using SurfaceView or GLSurfaceView.
Thanks in advance.
This link uses Texture View
https://github.com/google/grafika/blob/master/app/src/main/java/com/android/grafika/LiveCameraActivity.java
This uses surface view to play a movie..u can manipulate it for live camera
https://github.com/google/grafika/blob/master/app/src/main/java/com/android/grafika/PlayMovieSurfaceActivity.java
To choose on whether to use surfaceView or GLSurfaceView
take a look at this
Difference between SurfaceView and GLSurfaceView in Android
I have a camerapreview displayed on a textureView which works pretty well. But I can't mask the textureView with a circular mask. As soon as I use masking nothing gets displayed.
Is this not possible? Or is there another way?
You should use the API SurfaceTexture.
render camera frames to a SurfaceTexture created by yourself
draw the frame in the surfaceTexture to screen. During the drawing, you use a specific opengl vertex array to implement round corners.
Here is an very helpful article with source code on github.
https://medium.com/#fabrantes/rounded-video-corners-on-android-3467841cc1b
Can I set an ImageView to a camerapreview? Instead of using a surfaceview? I'm trying to make a camera preview semi transparent with setAlpha method, but It doesn't work on surfaceview. I mean it does work, but the camera preview is not semi transparent.
Well actually you can but not using SurfaceView. You achieve this by using GLSurface view, where you render each of your frame using shaders. In the fragment shader you can specify the opacity of your video. If you don't know OpenGL ES 2.0 you can start from here http://developer.android.com/training/graphics/opengl/index.html, but there are also many tutorial including rendering frames using opengl.
No you cannot do this, SurfaceView is the only way to create a Camera preview in Android.