Image overlay (on canvas) on VideoView?

I am trying to put a canvas over a VideoView. On this canvas, I would like to be able to draw images (or rectangles, lines, etc.).

I have the following snippet in my xml file.

<VideoView android:id="@+id/videoplayer" android:layout_width="fill_parent" android:layout_height="wrap_content" /> 

Again, my goal is to have a canvas over this VideoView so that I can post images to the canvas.

So, I would ultimately have images superimposed on the video. I would also like to be able to overlay rectangles and other elements.

Any help would be greatly appreciated! It was a lot harder than I thought!

+7
java android image
source share
3 answers

I wrote an application that does exactly what you are looking for. Unfortunately, I don’t have the code now, but I remember where I found the code that helped me a lot!

As you can see in this video , and this one , you can draw whatever you want at the top of the video pair, you just need to make sure that you don't drop the FPS too much.

Here you can find the tutorial and code. What I did, I began to take out pieces of code as soon as I found out what he did and what I want to change. It really sped up my work on the PoC I was working on.

I hope this helps, and I will be happy to help you if you need anything else.

Good luck

+7
source share

Use relative layout. Here is what I use to overlay the image in my map view:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.SupportMapFragment"/> <ImageView android:id="@+id/add_new_poi_icon_overlay" android:layout_width="match_parent" android:layout_height="match_parent" android:contentDescription="@string/add_new_poi_icon_content_description" android:scaleType="centerCrop" android:src="@drawable/overlay_with_watermark" android:visibility="gone" /> </RelativeLayout> 

Just change the type of scan to what you need, and use these options to place it where you want:

 android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="54dp" android:layout_marginLeft="36dp" 
+3
source share

i beleive you need more than an image, right?

So try the following:

  • use GLSurfaceView
  • create texture
  • create SurfaceTexture
  • create surface with surfacetexture
  • transfer MediaPlay output to the surface created above.
  • render surfacetexture
  • display other widgets (progressbar button, etc.)
+1
source share

All Articles