package com.basic.security.widget;
|
|
import android.content.Context;
|
import android.opengl.GLSurfaceView;
|
import android.util.AttributeSet;
|
import android.view.SurfaceHolder;
|
|
import com.basic.security.base.BaseApplication;
|
|
import java.io.File;
|
|
public class H264Player extends GLSurfaceView implements SurfaceHolder.Callback, Runnable {
|
public H264Player(Context context) {
|
super(context);
|
}
|
|
public H264Player(Context context, AttributeSet attrs) {
|
super(context, attrs);
|
}
|
|
public void surfaceCreated(SurfaceHolder holder) {
|
this.setVisibility(GONE);
|
}
|
|
public void surfaceDestroyed(SurfaceHolder holder) {
|
}
|
|
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
|
}
|
|
public native void Open(String url, Object surface);
|
|
public void run() {
|
try {
|
File file = new File("/sdcard/face2.mp4");
|
if (file.exists()) {
|
// Open("rtsp://admin:a1234567@192.168.1.201:554/h264/ch1/main/av_stream", getHolder().getSurface());
|
Open("/sdcard/face2.mp4", getHolder().getSurface());
|
} else {
|
BaseApplication.getApplication().activity.runOnUiThread(() -> H264Player.this.setVisibility(GONE));
|
}
|
// Open("rtmp://183.58.24.152/dreamStreamCore/qTl38me/lv800", getHolder().getSurface());
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}
|
}
|