コード例 #1
0
ファイル: EMVideoView.java プロジェクト: eygraber/ExoMedia
  /**
   * Requests the {@link VideoControls} to become visible. This should only be called after {@link
   * #setControls(VideoControls)}.
   */
  public void showControls() {
    if (videoControls != null) {
      videoControls.show();

      if (isPlaying()) {
        videoControls.hideDelayed(VideoControls.DEFAULT_CONTROL_HIDE_DELAY);
      }
    }
  }
コード例 #2
0
ファイル: EMVideoView.java プロジェクト: eygraber/ExoMedia
  /**
   * Moves the current video progress to the specified location.
   *
   * @param milliSeconds The time to move the playback to
   */
  public void seekTo(int milliSeconds) {
    if (videoControls != null) {
      videoControls.showLoading(false);
    }

    videoViewImpl.seekTo(milliSeconds);
  }
コード例 #3
0
ファイル: EMVideoView.java プロジェクト: eygraber/ExoMedia
  /** If a video is currently in playback then the playback will be suspended */
  public void suspend() {
    videoViewImpl.suspend();
    setKeepScreenOn(false);

    if (videoControls != null) {
      videoControls.updatePlaybackState(false);
    }
  }
コード例 #4
0
ファイル: EMVideoView.java プロジェクト: eygraber/ExoMedia
  /**
   * Starts the playback for the video specified in {@link #setVideoURI(android.net.Uri)} or {@link
   * #setVideoPath(String)}. This should be called after the VideoView is correctly prepared (see
   * {@link #setOnPreparedListener(OnPreparedListener)})
   */
  public void start() {
    videoViewImpl.start();
    setKeepScreenOn(true);

    if (videoControls != null) {
      videoControls.updatePlaybackState(true);
    }
  }
コード例 #5
0
ファイル: EMVideoView.java プロジェクト: eygraber/ExoMedia
  /**
   * Sets the Uri location for the video to play
   *
   * @param uri The video's Uri
   * @param renderBuilder RenderBuilder that should be used
   */
  public void setVideoURI(@Nullable Uri uri, @Nullable RenderBuilder renderBuilder) {
    videoUri = uri;
    videoViewImpl.setVideoUri(uri, renderBuilder);

    if (videoControls != null) {
      videoControls.showLoading(true);
    }
  }
コード例 #6
0
ファイル: EMVideoView.java プロジェクト: eygraber/ExoMedia
  /**
   * Sets the Uri location for the video to play
   *
   * @param uri The video's Uri
   */
  public void setVideoURI(@Nullable Uri uri) {
    videoUri = uri;
    videoViewImpl.setVideoUri(uri);

    if (videoControls != null) {
      videoControls.showLoading(true);
    }
  }
コード例 #7
0
ファイル: EMVideoView.java プロジェクト: eygraber/ExoMedia
  /**
   * If the video has completed playback, calling {@code restart} will seek to the beginning of the
   * video, and play it.
   *
   * @return {@code true} if the video was successfully restarted, otherwise {@code false}
   */
  public boolean restart() {
    if (videoUri == null) {
      return false;
    }

    if (videoViewImpl.restart()) {
      if (videoControls != null) {
        videoControls.showLoading(true);
      }
      return true;
    } else {
      return false;
    }
  }
コード例 #8
0
ファイル: EMVideoView.java プロジェクト: eygraber/ExoMedia
  public void setControls(@Nullable VideoControls controls) {
    if (videoControls != null && videoControls != controls) {
      removeView(videoControls);
    }

    if (controls != null) {
      videoControls = controls;
      controls.setVideoView(this);
      addView(controls);
    }

    // Sets the onTouch listener to show the controls
    TouchListener listener = new TouchListener(getContext());
    setOnTouchListener(videoControls != null ? listener : null);
  }