I managed to play video with TextureView and MediaPlayer on Android. I did it like this: I created a Surface with SurfaceTexture:
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int w, int h)
{
mSurface = new Surface(surfaceTexture);
...
...
}
Attatch the Surface to MediaPlayer:
try
{
mMediaPlayer.setDataSource(mPlayUrl);
mMediaPlayer.setSurface(mSurface);
...
...
}
That is OK, but not enough for me. I expect that the TextureView to be with round corners and look like a bubble(with an angle), look at the picture below:
I found an article(Round video corners on Android) which is very helpful, but the author chose GLSurfaceView and only implemented round corners. I believe that TextureView is also suitable for implementing my effect, SurfaceTexure processing is the key.But I am not familiar with opengl, Who can give me some advices?
I know it's late reply, but if anyone still struggle to finds solution below sample may help. https://github.com/developer-anees/android-round-camera2video-preview
Try this sample. It display camera preview in circle. Basically it use FrameLayout as parent to display Textureview in circle.
Given that your background is a solid color, you can easily achieve this effect with a mask. If you have any sort of background it wouldn't work though.