Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear video frame from surfaceview on video complete

I have created a media player which plays video on the surface view. After completion of video the last frame of the video remains on the surface. I want to remove the video frame from the surface because after some delay another video starts.

The flow of the video is:

NOW: Video on surface -> last video frame on surface -> another video on surface.

But the required flow is:

REQUIRED: Video on surface -> clear surface (black) -> another video on surface.

can anyone help to solve this problem.

Thanks Ishan jain

like image 256
ishan jain Avatar asked Sep 04 '14 08:09

ishan jain


People also ask

How do I clear my Surfaceview?

By setting the surfaceholder to TRANSPARENT, Android will destroy the surface. Then setting it back to OPAQUE creates a new surface "clearing" the surface.

What is a surface in Android?

A Surface is an object holding pixels that are being composited to the screen. Every window you see on the screen (a dialog, your full-screen activity, the status bar) has its own surface that it draws in to, and Surface Flinger renders these to the final display in their correct Z-order.


1 Answers

I have a sample problem and i fixed it by using these two lines after player release.

surfaceViewHolder.setFormat(PixelFormat.TRANSPARENT); surfaceViewHolder.setFormat(PixelFormat.OPAQUE);

like image 55
Zia Avatar answered Sep 20 '22 00:09

Zia