Hi,
I'm still looking for an answer to this question. Please help.
I'm trying to do following:
public class OverlayVideoView {
private Activity home;
private View overlayView;
public OverlayVideoView(Activity home, View overlayView){
this.home = home;
this.overlayView = overlayView;
playVideo();
}
private void playVideo() {
VideoView videoHolder = new VideoView(home);
MarginLayoutParams mparam = new MarginLayoutParams(200, 200);
mparam.setMargins(200, 200, 0, 0);
LayoutParams params = new LayoutParams(mparam);
home.addContentView(videoHolder, params);
// videoHolder.setLayoutParams(params);
// videoHolder.requestLayout();
videoHolder.setZOrderMediaOverlay(true);
videoHolder.setZOrderOnTop(true);
Uri video = Uri.parse("android.resource://" + home.getPackageName() + "/"
+ R.raw.royalstag);
videoHolder.setVideoURI(video);
videoHolder.start();
}
This adds a VideoView to the OverlayView. However, I'm not able to make the VideoView move as the image moves in the camera screen.
Please advise.
Best regards,
L
Just to clarify a bit:
as ppreuss said, the video on texture only works on Android 4.0 (ICS) and above;
the reason for this is that on the Android side it requires the class SurfaceTexture and (on the OpenGL side) the GL_EXTERNAL_TEXTURE_OES extension;
theoretically, SurfaceTexture and GL_EXTERNAL_TEXTURE_OES have been introduced in Android 3.0 (Honeycomb), i.e. API level 11.
However, they practically work as of Android 4.0 (ICS), i.e. API level 14 and above.
So, for anything below ICS, the Video on texture will not work, as the APIs above is not available; in such a case, the VideoPlayback sample can still work in fullscreen mode, but not in textured mode.