コード例 #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
  @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);
  }