Video and graphics on the same view

All your problems with Audio, Video and Images.

Video and graphics on the same view

Postby playnext » Fri Aug 20, 2010 8:40 pm


Please explain how could be resolved the problem:
I tried to write the code which draws graphics using canvas on the same view where video is playing.
I use SurfaceView (or VideoView) assigning it to MediaPlayer object.
There is a separate thread where SurfaceHolder.lockCanvas is called to retrieve Canvas object. This object is put as parameter to overridden method SurfaceView.onDraw then some graphics is drawn there but video disappeared. It also disappeared if the method SurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS) was not called before. If it is called the lockCanvas returns null but video is OK in this case (There is some information about such behavior in documentation).
The question is - how is to draw graphics over playing video on the SurfaceView object?
Once Poster
Once Poster
Posts: 1
Joined: Fri Aug 20, 2010 8:14 pm


Re: Video and graphics on the same view

Postby blundell » Fri Aug 27, 2010 12:16 pm

Use a Framelayou with a surface view and another view, then draw on the second view :-)
User avatar
Master Developer
Master Developer
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 7 guests