I plan to implement a feature playing several videos in one screen simultaneously and video views can be scrolled while they are playing videos.
I am going to add video views to a ListView which acts as their parent view. We should not use SurfaceView to render the video stream, because SurfaceView can not be redrawed by android view hierarchy. It is a bad idea to scroll SurfaceView.
Fortunately, TextureView was added since API level 14, it was a replacer of SurfaceView. So I can use it to achieve my plan.
But TextureView is available only above API level 14. In fact, I was demanded to implement this feature in a platform which is not lower than API level 11.
I start to pay attention to SurfaceTexture which was added to android since API level 11, We can use SurfaceTexture to either put the camera image stream or video decoded stream onto an OpenGL texture, I also know that android view hierarchy is drawed by opengl instead of skia since api level 11.
So I wonder if I can render the video stream onto a ordinary android view using SurfaceTexture.
In other words, can we implement a customized widget for api level 11-13 to replace the position of TextureView added since api level 14?
I have looked into the source code of android.view.TextureView,it is not very complicated, the dependence classes are as follow:
package android.view;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.os.Looper;
import android.util.AttributeSet;
import android.util.Log;
And there are 4 native apis:
private native void nCreateNativeWindow(SurfaceTexture surface);
private native void nDestroyNativeWindow();
private static native boolean nLockCanvas(int nativeWindow, Canvas canvas, Rect dirty);
private static native void nUnlockCanvasAndPost(int nativeWindow, Canvas canvas);
Is it possible to transplant the class TextureView to android api level 11-13?
Who can give me some advices?