Пример #1
0
  /**
   * 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(android.media.MediaPlayer.OnPreparedListener)})
   */
  public void start() {
    if (!useExo) {
      videoView.start();
    } else {
      emExoPlayer.setPlayWhenReady(true);
    }

    if (defaultControls != null) {
      defaultControls.updatePlayPauseImage(true);
      defaultControls.hideDelayed(DefaultControls.DEFAULT_CONTROL_HIDE_DELAY);
    }

    playRequested = true;
    startProgressPoll();
  }
Пример #2
0
  /**
   * Enables and disables the media control overlay for the video view
   *
   * @param enabled Weather the default video controls are enabled (default: false)
   */
  public void setDefaultControlsEnabled(boolean enabled) {
    if (defaultControls == null && enabled) {
      defaultControls =
          EMDeviceUtil.isDeviceTV(getContext())
              ? new DefaultControlsLeanback(getContext())
              : new DefaultControlsMobile(getContext());
      defaultControls.setVideoView(this);
      defaultControls.setBus(bus);

      addView(defaultControls);
      startProgressPoll();
    } else if (defaultControls != null && !enabled) {
      removeView(defaultControls);
      defaultControls = null;

      if (bus == null) {
        stopProgressPoll();
      }
    }

    // Sets the onTouch listener to show the default controls
    TouchListener listener = new TouchListener(getContext());
    setOnTouchListener(enabled ? listener : null);
  }
Пример #3
0
 /**
  * Starts the progress poll with the callback to be informed of the progress events.
  *
  * @param callback The Callback to inform of progress events
  */
 public void startProgressPoll(EMProgressCallback callback) {
   progressCallback = callback;
   startProgressPoll();
 }
Пример #4
0
 /**
  * Starts the progress poll. If you have already called {@link #setBus(EMEventBus)} then you
  * should use the {@link #startProgressPoll()} method instead.
  *
  * @param bus The EventBus event dispatcher that the listener is connected to
  */
 public void startProgressPoll(@Nullable EMEventBus bus) {
   setBus(bus);
   startProgressPoll();
 }