コード例 #1
0
 protected ContentVideoView(
     Context context, long nativeContentVideoView, ContentVideoViewClient client) {
   super(context);
   mNativeContentVideoView = nativeContentVideoView;
   mViewAndroid = new ViewAndroid(new WindowAndroid(context.getApplicationContext()), this);
   mClient = client;
   initResources(context);
   mVideoSurfaceView = new VideoSurfaceView(context);
   showContentVideoView();
   setVisibility(View.VISIBLE);
   mClient.onShowCustomView(this);
 }
コード例 #2
0
  /**
   * This method shall only be called by native and exitFullscreen, To exit fullscreen, use
   * exitFullscreen in Java.
   */
  @CalledByNative
  protected void destroyContentVideoView(boolean nativeViewDestroyed) {
    if (mVideoSurfaceView != null) {
      removeSurfaceView();
      setVisibility(View.GONE);

      // To prevent re-entrance, call this after removeSurfaceView.
      mClient.onDestroyContentVideoView();
    }
    if (nativeViewDestroyed) {
      mNativeContentVideoView = 0;
    }
  }
コード例 #3
0
 private ContentVideoView(
     Context context, int nativeContentVideoView, ContentVideoViewClient client) {
   super(context);
   mNativeContentVideoView = nativeContentVideoView;
   mClient = client;
   initResources(context);
   mCurrentBufferPercentage = 0;
   mVideoSurfaceView = new VideoSurfaceView(context);
   setBackgroundColor(Color.BLACK);
   showContentVideoView();
   setVisibility(View.VISIBLE);
   mClient.onShowCustomView(this);
 }
コード例 #4
0
 @CalledByNative
 private void openVideo() {
   if (mSurfaceHolder != null) {
     mCurrentState = STATE_IDLE;
     mCurrentBufferPercentage = 0;
     ContentVideoViewControls controls = mClient.createControls();
     if (controls == null) {
       controls = new FullScreenControls(getContext(), this);
     }
     setControls(controls);
     if (mNativeContentVideoView != 0) {
       nativeUpdateMediaMetadata(mNativeContentVideoView);
       nativeSetSurface(mNativeContentVideoView, mSurfaceHolder.getSurface());
     }
   }
 }
コード例 #5
0
  protected void showContentVideoView() {
    mVideoSurfaceView.getHolder().addCallback(this);
    this.addView(
        mVideoSurfaceView,
        new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT,
            Gravity.CENTER));

    mProgressView = mClient.getVideoLoadingProgressView();
    if (mProgressView == null) {
      mProgressView = new ProgressView(getContext(), mVideoLoadingText);
    }
    this.addView(
        mProgressView,
        new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            Gravity.CENTER));
  }
コード例 #6
0
 private void showContentVideoView() {
   FrameLayout.LayoutParams layoutParams =
       new FrameLayout.LayoutParams(
           ViewGroup.LayoutParams.WRAP_CONTENT,
           ViewGroup.LayoutParams.WRAP_CONTENT,
           Gravity.CENTER);
   this.addView(mVideoSurfaceView, layoutParams);
   View progressView = mClient.getVideoLoadingProgressView();
   if (progressView != null) {
     mProgressView = progressView;
   } else {
     mProgressView = new ProgressView(getContext(), mVideoLoadingText);
   }
   this.addView(mProgressView, layoutParams);
   mVideoSurfaceView.setZOrderOnTop(true);
   mVideoSurfaceView.setOnKeyListener(this);
   mVideoSurfaceView.setOnTouchListener(this);
   mVideoSurfaceView.getHolder().addCallback(this);
   mVideoSurfaceView.setFocusable(true);
   mVideoSurfaceView.setFocusableInTouchMode(true);
   mVideoSurfaceView.requestFocus();
 }