Exemplo n.º 1
0
  /**
   * If a video is currently in playback then the playback will be stopped and the progressPoll will
   * be stopped (see {@link #startProgressPoll()})
   */
  public void stopPlayback() {
    if (!useExo) {
      videoView.stopPlayback();
    } else {
      emExoPlayer.setPlayWhenReady(false);
    }

    if (defaultControls != null) {
      defaultControls.updatePlayPauseImage(false);
      defaultControls.show();
    }

    playRequested = false;
    stopProgressPoll();
  }
Exemplo n.º 2
0
  /**
   * If a video is currently in playback then the playback will be suspended and and the
   * progressPoll will be stopped (see {@link #startProgressPoll()})
   */
  public void suspend() {
    if (!useExo) {
      videoView.suspend();
    } else {
      emExoPlayer.release();
    }

    if (defaultControls != null) {
      defaultControls.updatePlayPauseImage(false);
      defaultControls.show();
    }

    playRequested = false;
    stopProgressPoll();
  }
Exemplo n.º 3
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);
  }