use of android.view.TextureView.SurfaceTextureListener in project android_packages_apps_Settings by LineageOS.
the class FingerprintLocationAnimationVideoViewTest method onSurfaceTextureAvailable_nullMediaPlayer_shouldNotCrash.
@Test
public void onSurfaceTextureAvailable_nullMediaPlayer_shouldNotCrash() {
mView.onFinishInflate();
final SurfaceTextureListener listener = mView.getSurfaceTextureListener();
when(mView.createMediaPlayer(any(Context.class), any(Uri.class))).thenReturn(null);
listener.onSurfaceTextureAvailable(mock(SurfaceTexture.class), 48, 48);
// should not crash
}
use of android.view.TextureView.SurfaceTextureListener in project android_packages_apps_Settings by omnirom.
the class FingerprintLocationAnimationVideoViewTest method onSurfaceTextureAvailable_nullMediaPlayer_shouldNotCrash.
@Test
public void onSurfaceTextureAvailable_nullMediaPlayer_shouldNotCrash() {
mView.onFinishInflate();
final SurfaceTextureListener listener = mView.getSurfaceTextureListener();
when(mView.createMediaPlayer(any(Context.class), any(Uri.class))).thenReturn(null);
listener.onSurfaceTextureAvailable(mock(SurfaceTexture.class), 48, 48);
// should not crash
}
use of android.view.TextureView.SurfaceTextureListener in project android_packages_apps_Settings by DirtyUnicorns.
the class FingerprintLocationAnimationVideoViewTest method onSurfaceTextureAvailable_nullMediaPlayer_shouldNotCrash.
@Test
public void onSurfaceTextureAvailable_nullMediaPlayer_shouldNotCrash() {
mView.onFinishInflate();
final SurfaceTextureListener listener = mView.getSurfaceTextureListener();
when(mView.createMediaPlayer(any(Context.class), any(Uri.class))).thenReturn(null);
listener.onSurfaceTextureAvailable(mock(SurfaceTexture.class), 48, 48);
// should not crash
}
use of android.view.TextureView.SurfaceTextureListener in project LanSoEditor_common by LanSoSdk.
the class VideoPlayerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.player_layout);
textureView = (TextureRenderView) findViewById(R.id.surface1);
videoPath = getIntent().getStringExtra("videopath");
TextView tvScreen = (TextView) findViewById(R.id.id_palyer_screenhinit);
TextView tvVideoRatio = (TextView) findViewById(R.id.id_palyer_videoRatio);
TextView tvVideoDuration = (TextView) findViewById(R.id.id_palyer_videoduration);
tvSizeHint = (TextView) findViewById(R.id.id_palyer_videosizehint);
// 获取屏幕密度(方法2)
DisplayMetrics dm = new DisplayMetrics();
dm = getResources().getDisplayMetrics();
screenWidth = dm.widthPixels;
screenHeight = dm.heightPixels;
String str = "当前屏幕分辨率:";
str += String.valueOf(screenWidth);
str += "x";
str += String.valueOf(screenHeight);
tvScreen.setText(str);
mInfo = new MediaInfo(videoPath, false);
if (mInfo.prepare() == false) {
showHintDialog();
isSupport = false;
} else {
isSupport = true;
str = "当前视频分辨率:";
str += String.valueOf(mInfo.vWidth);
str += "x";
str += String.valueOf(mInfo.vHeight);
tvVideoRatio.setText(str);
str = "当前视频时长:";
str += String.valueOf(mInfo.vDuration);
str += "\n文件大小:" + new File(videoPath).length();
tvVideoDuration.setText(str);
}
textureView.setSurfaceTextureListener(new SurfaceTextureListener() {
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
// TODO Auto-generated method stub
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// TODO Auto-generated method stub
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
// TODO Auto-generated method stub
if (isSupport) {
// play(new Surface(surface));
startVPlayer(new Surface(surface));
}
}
});
}
use of android.view.TextureView.SurfaceTextureListener in project platform_packages_apps_Settings by BlissRoms.
the class FingerprintLocationAnimationVideoViewTest method onSurfaceTextureAvailable_nullMediaPlayer_shouldNotCrash.
@Test
public void onSurfaceTextureAvailable_nullMediaPlayer_shouldNotCrash() {
mView.onFinishInflate();
final SurfaceTextureListener listener = mView.getSurfaceTextureListener();
when(mView.createMediaPlayer(any(Context.class), any(Uri.class))).thenReturn(null);
listener.onSurfaceTextureAvailable(mock(SurfaceTexture.class), 48, 48);
// should not crash
}
Aggregations