Search in sources :

Example 1 with SurfaceTextureListener

use of android.view.TextureView.SurfaceTextureListener in project android_packages_apps_Settings by crdroidandroid.

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
}
Also used : Context(android.content.Context) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceTextureListener(android.view.TextureView.SurfaceTextureListener) Uri(android.net.Uri) Test(org.junit.Test)

Example 2 with SurfaceTextureListener

use of android.view.TextureView.SurfaceTextureListener in project android_packages_apps_Settings by SudaMod.

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
}
Also used : Context(android.content.Context) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceTextureListener(android.view.TextureView.SurfaceTextureListener) Uri(android.net.Uri) Test(org.junit.Test)

Example 3 with SurfaceTextureListener

use of android.view.TextureView.SurfaceTextureListener in project LanSoEditor_advance 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);
    tvVideoDuration = (TextView) findViewById(R.id.id_palyer_videoduration);
    tvSizeHint = (TextView) findViewById(R.id.id_palyer_videosizehint);
    tvPlayWidget = (TextView) findViewById(R.id.id_palyer_widget);
    // 获取屏幕密度(方法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 {
        Log.i(TAG, "info:" + mInfo.toString());
        isSupport = true;
        str = "当前视频分辨率:";
        str += String.valueOf(mInfo.vWidth);
        str += "x";
        str += String.valueOf(mInfo.vHeight);
        tvVideoRatio.setText(str);
        str = "当前视频时长:";
        str += String.valueOf(mInfo.vDuration);
        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) {
        }

        @Override
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
            return false;
        }

        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
            if (isSupport) {
                // 采用系统本身的MediaPlayer播放
                play(new Surface(surface));
            // startVPlayer(new Surface(surface));  //我们SDK提供的播放器.
            }
        }
    });
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceTextureListener(android.view.TextureView.SurfaceTextureListener) TextView(android.widget.TextView) DisplayMetrics(android.util.DisplayMetrics) Surface(android.view.Surface)

Example 4 with SurfaceTextureListener

use of android.view.TextureView.SurfaceTextureListener in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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
}
Also used : Context(android.content.Context) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceTextureListener(android.view.TextureView.SurfaceTextureListener) Uri(android.net.Uri) Test(org.junit.Test)

Example 5 with SurfaceTextureListener

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
}
Also used : Context(android.content.Context) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceTextureListener(android.view.TextureView.SurfaceTextureListener) Uri(android.net.Uri) Test(org.junit.Test)

Aggregations

SurfaceTexture (android.graphics.SurfaceTexture)10 SurfaceTextureListener (android.view.TextureView.SurfaceTextureListener)10 Context (android.content.Context)8 Uri (android.net.Uri)8 Test (org.junit.Test)8 DisplayMetrics (android.util.DisplayMetrics)2 Surface (android.view.Surface)2 TextView (android.widget.TextView)2 MediaInfo (com.lansosdk.videoeditor.MediaInfo)2 File (java.io.File)1