예제 #1
0
  /**
   * 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);
  }
예제 #2
0
  /**
   * Stops the playback and releases all resources attached to this EMVideoView. This should not be
   * called manually unless {@link #setReleaseOnDetachFromWindow(boolean)} has been set.
   */
  public void release() {
    videoControls = null;
    stopPlayback();
    overriddenPositionStopWatch.stop();

    videoViewImpl.release();
  }
예제 #3
0
  /**
   * Retrieves the current position of the audio playback. If an audio item is not currently in
   * playback then the value will be 0. This should only be called after the item is prepared (see
   * {@link #setOnPreparedListener(OnPreparedListener)})
   *
   * @return The millisecond value for the current position
   */
  public int getCurrentPosition() {
    if (overridePosition) {
      return positionOffset + overriddenPositionStopWatch.getTimeInt();
    }

    return positionOffset + videoViewImpl.getCurrentPosition();
  }
예제 #4
0
  /**
   * Retrieves the duration of the current audio item. This should only be called after the item is
   * prepared (see {@link #setOnPreparedListener(OnPreparedListener)}). If {@link
   * #overrideDuration(int)} is set then that value will be returned.
   *
   * @return The millisecond duration of the video
   */
  public int getDuration() {
    if (overriddenDuration >= 0) {
      return overriddenDuration;
    }

    return videoViewImpl.getDuration();
  }
예제 #5
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(OnPreparedListener)})
   */
  public void start() {
    videoViewImpl.start();
    setKeepScreenOn(true);

    if (videoControls != null) {
      videoControls.updatePlaybackState(true);
    }
  }
예제 #6
0
  /**
   * 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);
    }
  }
예제 #7
0
  /**
   * 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);
    }
  }
예제 #8
0
  /** 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);
    }
  }
예제 #9
0
  /**
   * Performs the initialization of the view including inflating the correct backing layout, linking
   * the implementation, and finding the necessary view references.
   *
   * @param context The context for the initialization
   * @param attrs The xml attributes associated with this instance
   */
  protected void initView(Context context, @Nullable AttributeSet attrs) {
    inflateVideoView(context, attrs);

    previewImageView = (ImageView) findViewById(R.id.exomedia_video_preview_image);
    videoViewImpl = (VideoViewApi) findViewById(R.id.exomedia_video_view);

    muxNotifier = new MuxNotifier();
    listenerMux = new EMListenerMux(muxNotifier);

    videoViewImpl.setListenerMux(listenerMux);
  }
예제 #10
0
  /**
   * 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;
    }
  }
예제 #11
0
 @Override
 public void setOnTouchListener(OnTouchListener listener) {
   videoViewImpl.setOnTouchListener(listener);
   super.setOnTouchListener(listener);
 }
예제 #12
0
 /**
  * Sets the rotation for the Video
  *
  * @param rotation The rotation to apply to the video
  */
 public void setVideoRotation(@IntRange(from = 0, to = 359) int rotation) {
   videoViewImpl.setVideoRotation(rotation, true);
 }
예제 #13
0
 /**
  * Measures the underlying {@link VideoViewApi} using the video's aspect ratio if {@code true}
  *
  * @param measureBasedOnAspectRatioEnabled whether to measure using the video's aspect ratio or
  *     not
  */
 public void setMeasureBasedOnAspectRatioEnabled(boolean measureBasedOnAspectRatioEnabled) {
   videoViewImpl.setMeasureBasedOnAspectRatioEnabled(measureBasedOnAspectRatioEnabled);
 }
예제 #14
0
 /**
  * Sets how the video should be scaled in the view
  *
  * @param scaleType how to scale the videos
  */
 public void setScaleType(@NonNull ScaleType scaleType) {
   videoViewImpl.setScaleType(scaleType);
 }
예제 #15
0
 /**
  * Retrieves a list of available tracks to select from. Typically {@link
  * #trackSelectionAvailable()} should be called before this.
  *
  * @return A list of available tracks associated with each track type (see {@link
  *     com.devbrackets.android.exomedia.annotation.TrackRenderType})
  */
 @Nullable
 public Map<Integer, List<MediaFormat>> getAvailableTracks() {
   return videoViewImpl.getAvailableTracks();
 }
예제 #16
0
 /**
  * Changes to the track with <code>trackIndex</code> for the specified <code>trackType</code>
  *
  * @param trackType The type for the track to switch to the selected index
  * @param trackIndex The index for the track to swith to
  */
 public void setTrack(@TrackRenderType int trackType, int trackIndex) {
   videoViewImpl.setTrack(trackType, trackIndex);
 }
예제 #17
0
 /**
  * Determines if the current video player implementation supports track selection for audio or
  * video tracks.
  *
  * @return True if tracks can be manually specified
  */
 public boolean trackSelectionAvailable() {
   return videoViewImpl.trackSelectionAvailable();
 }
예제 #18
0
 /**
  * Retrieves the current buffer percent of the video. If a video is not currently prepared or
  * buffering the value will be 0. This should only be called after the video is prepared (see
  * {@link #setOnPreparedListener(OnPreparedListener)})
  *
  * @return The integer percent that is buffered [0, 100] inclusive
  */
 public int getBufferPercentage() {
   return videoViewImpl.getBufferedPercent();
 }
예제 #19
0
 /**
  * Sets the volume level for devices that support the ExoPlayer (JellyBean or greater).
  *
  * @param volume The volume range [0.0 - 1.0]
  * @return True if the volume was set
  */
 public boolean setVolume(@FloatRange(from = 0.0, to = 1.0) float volume) {
   return videoViewImpl.setVolume(volume);
 }
예제 #20
0
 /**
  * Returns if a video is currently in playback
  *
  * @return True if a video is playing
  */
 public boolean isPlaying() {
   return videoViewImpl.isPlaying();
 }