예제 #1
0
  @Override
  protected void onAwaitingVideoSurface() {
    if (videoSurfaceCreated) {
      if (BuildConfig.DEBUG) Log.d(TAG, "Videosurface already created, setting videosurface now");

      Pair<Integer, Integer> videoSize = controller.getVideoSize();
      if (videoSize != null && videoSize.first > 0 && videoSize.second > 0) {
        if (BuildConfig.DEBUG)
          Log.d(TAG, "Width,height of video: " + videoSize.first + ", " + videoSize.second);
        videoview.setVideoSize(videoSize.first, videoSize.second);
      } else {
        Log.e(TAG, "Could not determine video size");
      }
      controller.setVideoSurface(videoview.getHolder());
    }
  }
예제 #2
0
 @SuppressLint("NewApi")
 private void showVideoControls() {
   videoOverlay.setVisibility(View.VISIBLE);
   butPlay.setVisibility(View.VISIBLE);
   final Animation animation = AnimationUtils.loadAnimation(this, R.anim.fade_in);
   if (animation != null) {
     videoOverlay.startAnimation(animation);
     butPlay.startAnimation(animation);
   }
   if (Build.VERSION.SDK_INT >= 14) {
     videoview.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
   }
 }
예제 #3
0
  @Override
  protected void setupGUI() {
    super.setupGUI();
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    videoOverlay = (LinearLayout) findViewById(R.id.overlay);
    videoview = (AspectRatioVideoView) findViewById(R.id.videoview);
    progressIndicator = (ProgressBar) findViewById(R.id.progressIndicator);
    videoview.getHolder().addCallback(surfaceHolderCallback);
    videoview.setOnTouchListener(onVideoviewTouched);

    if (Build.VERSION.SDK_INT >= 16) {
      videoview.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    }
    if (Build.VERSION.SDK_INT >= 14) {
      videoOverlay.setFitsSystemWindows(true);
    }

    setupVideoControlsToggler();
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  }