public class

StubExoPlayer

extends StubPlayer

implements ExoPlayer

 java.lang.Object

androidx.media3.common.BasePlayer

androidx.media3.test.utils.StubPlayer

↳androidx.media3.test.utils.StubExoPlayer

Gradle dependencies

compile group: 'androidx.media3', name: 'media3-test-utils', version: '1.5.0-alpha01'

  • groupId: androidx.media3
  • artifactId: media3-test-utils
  • version: 1.5.0-alpha01

Artifact androidx.media3:media3-test-utils:1.5.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

An abstract ExoPlayer implementation that throws java.lang.UnsupportedOperationException from every method.

Summary

Fields
from BasePlayerwindow
Constructors
publicStubExoPlayer()

Methods
public voidaddAnalyticsListener(AnalyticsListener listener)

public voidaddAudioOffloadListener(ExoPlayer.AudioOffloadListener listener)

public voidaddMediaSource(int index, MediaSource mediaSource)

public voidaddMediaSource(MediaSource mediaSource)

public voidaddMediaSources(int index, java.util.List<MediaSource> mediaSources)

public voidaddMediaSources(java.util.List<MediaSource> mediaSources)

public voidclearAuxEffectInfo()

public voidclearCameraMotionListener(CameraMotionListener listener)

public voidclearVideoFrameMetadataListener(VideoFrameMetadataListener listener)

public PlayerMessagecreateMessage(PlayerMessage.Target target)

public AnalyticsCollectorgetAnalyticsCollector()

public ExoPlayer.AudioComponentgetAudioComponent()

public DecoderCountersgetAudioDecoderCounters()

public FormatgetAudioFormat()

public intgetAudioSessionId()

public ClockgetClock()

public TrackGroupArraygetCurrentTrackGroups()

public TrackSelectionArraygetCurrentTrackSelections()

public ExoPlayer.DeviceComponentgetDeviceComponent()

public booleangetPauseAtEndOfMediaItems()

public LoopergetPlaybackLooper()

public ExoPlaybackExceptiongetPlayerError()

public ExoPlayer.PreloadConfigurationgetPreloadConfiguration()

public RenderergetRenderer(int index)

public intgetRendererCount()

public intgetRendererType(int index)

public SeekParametersgetSeekParameters()

public booleangetSkipSilenceEnabled()

public ExoPlayer.TextComponentgetTextComponent()

public TrackSelectorgetTrackSelector()

public intgetVideoChangeFrameRateStrategy()

public ExoPlayer.VideoComponentgetVideoComponent()

public DecoderCountersgetVideoDecoderCounters()

public FormatgetVideoFormat()

public intgetVideoScalingMode()

public booleanisReleased()

public booleanisSleepingForOffload()

public booleanisTunnelingEnabled()

public voidprepare(MediaSource mediaSource)

public voidprepare(MediaSource mediaSource, boolean resetPosition, boolean resetState)

public voidremoveAnalyticsListener(AnalyticsListener listener)

public voidremoveAudioOffloadListener(ExoPlayer.AudioOffloadListener listener)

public voidsetAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus)

public voidsetAudioSessionId(int audioSessionId)

public voidsetAuxEffectInfo(AuxEffectInfo auxEffectInfo)

public voidsetCameraMotionListener(CameraMotionListener listener)

public voidsetForegroundMode(boolean foregroundMode)

public voidsetHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy)

public voidsetImageOutput(ImageOutput imageOutput)

public voidsetMediaSource(MediaSource mediaSource)

public voidsetMediaSource(MediaSource mediaSource, boolean resetPosition)

public voidsetMediaSource(MediaSource mediaSource, long startPositionMs)

public voidsetMediaSources(java.util.List<MediaSource> mediaSources)

public voidsetMediaSources(java.util.List<MediaSource> mediaSources, boolean resetPosition)

public voidsetMediaSources(java.util.List<MediaSource> mediaSources, int startMediaItemIndex, long startPositionMs)

public voidsetPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems)

public voidsetPreferredAudioDevice(AudioDeviceInfo audioDeviceInfo)

public voidsetPreloadConfiguration(ExoPlayer.PreloadConfiguration preloadConfiguration)

public voidsetPriority(int priority)

public voidsetPriorityTaskManager(PriorityTaskManager priorityTaskManager)

public voidsetSeekParameters(SeekParameters seekParameters)

public voidsetShuffleOrder(ShuffleOrder shuffleOrder)

public voidsetSkipSilenceEnabled(boolean skipSilenceEnabled)

public voidsetVideoChangeFrameRateStrategy(int videoChangeFrameRateStrategy)

public voidsetVideoEffects(java.util.List<Effect> videoEffects)

public voidsetVideoFrameMetadataListener(VideoFrameMetadataListener listener)

public voidsetVideoScalingMode(int videoScalingMode)

public voidsetWakeMode(int wakeMode)

from StubPlayeraddListener, addMediaItems, clearVideoSurface, clearVideoSurface, clearVideoSurfaceHolder, clearVideoSurfaceView, clearVideoTextureView, decreaseDeviceVolume, decreaseDeviceVolume, getApplicationLooper, getAudioAttributes, getAvailableCommands, getBufferedPosition, getContentBufferedPosition, getContentPosition, getCurrentAdGroupIndex, getCurrentAdIndexInAdGroup, getCurrentCues, getCurrentMediaItemIndex, getCurrentPeriodIndex, getCurrentPosition, getCurrentTimeline, getCurrentTracks, getDeviceInfo, getDeviceVolume, getDuration, getMaxSeekToPreviousPosition, getMediaMetadata, getPlaybackParameters, getPlaybackState, getPlaybackSuppressionReason, getPlaylistMetadata, getPlayWhenReady, getRepeatMode, getSeekBackIncrement, getSeekForwardIncrement, getShuffleModeEnabled, getSurfaceSize, getTotalBufferedDuration, getTrackSelectionParameters, getVideoSize, getVolume, increaseDeviceVolume, increaseDeviceVolume, isDeviceMuted, isLoading, isPlayingAd, moveMediaItems, prepare, release, removeListener, removeMediaItems, replaceMediaItems, seekTo, setDeviceMuted, setDeviceMuted, setDeviceVolume, setDeviceVolume, setMediaItems, setMediaItems, setPlaybackParameters, setPlaylistMetadata, setPlayWhenReady, setRepeatMode, setShuffleModeEnabled, setTrackSelectionParameters, setVideoSurface, setVideoSurfaceHolder, setVideoSurfaceView, setVideoTextureView, setVolume, stop
from BasePlayeraddMediaItem, addMediaItem, addMediaItems, canAdvertiseSession, clearMediaItems, getBufferedPercentage, getContentDuration, getCurrentLiveOffset, getCurrentManifest, getCurrentMediaItem, getCurrentWindowIndex, getMediaItemAt, getMediaItemCount, getNextMediaItemIndex, getNextWindowIndex, getPreviousMediaItemIndex, getPreviousWindowIndex, hasNext, hasNextMediaItem, hasNextWindow, hasPreviousMediaItem, isCommandAvailable, isCurrentMediaItemDynamic, isCurrentMediaItemLive, isCurrentMediaItemSeekable, isCurrentWindowDynamic, isCurrentWindowLive, isCurrentWindowSeekable, isPlaying, moveMediaItem, next, pause, play, removeMediaItem, replaceMediaItem, seekBack, seekForward, seekTo, seekTo, seekToDefaultPosition, seekToDefaultPosition, seekToNext, seekToNextMediaItem, seekToNextWindow, seekToPrevious, seekToPreviousMediaItem, seekToPreviousWindow, setMediaItem, setMediaItem, setMediaItem, setMediaItems, setPlaybackSpeed
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public StubExoPlayer()

Methods

public ExoPlayer.AudioComponent getAudioComponent()

Deprecated: Use ExoPlayer, as the methods are defined by that interface.

public ExoPlayer.VideoComponent getVideoComponent()

Deprecated: Use ExoPlayer, as the methods are defined by that interface.

public ExoPlayer.TextComponent getTextComponent()

Deprecated: Use Player, as the methods are defined by that interface.

public ExoPlayer.DeviceComponent getDeviceComponent()

Deprecated: Use Player, as the methods are defined by that interface.

public Looper getPlaybackLooper()

public Clock getClock()

public void addAudioOffloadListener(ExoPlayer.AudioOffloadListener listener)

public void removeAudioOffloadListener(ExoPlayer.AudioOffloadListener listener)

public AnalyticsCollector getAnalyticsCollector()

public void addAnalyticsListener(AnalyticsListener listener)

public void removeAnalyticsListener(AnalyticsListener listener)

public ExoPlaybackException getPlayerError()

public void prepare(MediaSource mediaSource)

Deprecated: Use StubExoPlayer.setMediaSource(MediaSource) and StubPlayer.prepare() instead.

public void prepare(MediaSource mediaSource, boolean resetPosition, boolean resetState)

Deprecated: Use StubExoPlayer.setMediaSource(MediaSource, boolean) and StubPlayer.prepare() instead.

public void setPreloadConfiguration(ExoPlayer.PreloadConfiguration preloadConfiguration)

public ExoPlayer.PreloadConfiguration getPreloadConfiguration()

public void setMediaSource(MediaSource mediaSource)

public void setMediaSource(MediaSource mediaSource, long startPositionMs)

public void setMediaSource(MediaSource mediaSource, boolean resetPosition)

public void setMediaSources(java.util.List<MediaSource> mediaSources)

public void setMediaSources(java.util.List<MediaSource> mediaSources, boolean resetPosition)

public void setMediaSources(java.util.List<MediaSource> mediaSources, int startMediaItemIndex, long startPositionMs)

public void addMediaSource(MediaSource mediaSource)

public void addMediaSource(int index, MediaSource mediaSource)

public void addMediaSources(java.util.List<MediaSource> mediaSources)

public void addMediaSources(int index, java.util.List<MediaSource> mediaSources)

public void setShuffleOrder(ShuffleOrder shuffleOrder)

public void setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus)

public void setAudioSessionId(int audioSessionId)

public int getAudioSessionId()

public void setAuxEffectInfo(AuxEffectInfo auxEffectInfo)

public void clearAuxEffectInfo()

public void setPreferredAudioDevice(AudioDeviceInfo audioDeviceInfo)

public void setSkipSilenceEnabled(boolean skipSilenceEnabled)

public boolean getSkipSilenceEnabled()

public void setVideoEffects(java.util.List<Effect> videoEffects)

public void setVideoScalingMode(int videoScalingMode)

public int getVideoScalingMode()

public void setVideoChangeFrameRateStrategy(int videoChangeFrameRateStrategy)

public int getVideoChangeFrameRateStrategy()

public void setVideoFrameMetadataListener(VideoFrameMetadataListener listener)

public void clearVideoFrameMetadataListener(VideoFrameMetadataListener listener)

public void setCameraMotionListener(CameraMotionListener listener)

public void clearCameraMotionListener(CameraMotionListener listener)

public void setSeekParameters(SeekParameters seekParameters)

public SeekParameters getSeekParameters()

public PlayerMessage createMessage(PlayerMessage.Target target)

public int getRendererCount()

public int getRendererType(int index)

public Renderer getRenderer(int index)

public TrackSelector getTrackSelector()

public TrackGroupArray getCurrentTrackGroups()

Deprecated: Use StubPlayer.getCurrentTracks().

public TrackSelectionArray getCurrentTrackSelections()

Deprecated: Use StubPlayer.getCurrentTracks().

public void setForegroundMode(boolean foregroundMode)

public void setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems)

public boolean getPauseAtEndOfMediaItems()

public Format getAudioFormat()

public Format getVideoFormat()

public DecoderCounters getAudioDecoderCounters()

public DecoderCounters getVideoDecoderCounters()

public void setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy)

public void setWakeMode(int wakeMode)

public void setPriority(int priority)

public void setPriorityTaskManager(PriorityTaskManager priorityTaskManager)

public boolean isSleepingForOffload()

public boolean isTunnelingEnabled()

public boolean isReleased()

public void setImageOutput(ImageOutput imageOutput)

Source

/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package androidx.media3.test.utils;

import android.media.AudioDeviceInfo;
import android.os.Looper;
import androidx.annotation.Nullable;
import androidx.media3.common.AudioAttributes;
import androidx.media3.common.AuxEffectInfo;
import androidx.media3.common.C;
import androidx.media3.common.Effect;
import androidx.media3.common.Format;
import androidx.media3.common.Player;
import androidx.media3.common.PriorityTaskManager;
import androidx.media3.common.util.Clock;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.exoplayer.DecoderCounters;
import androidx.media3.exoplayer.ExoPlaybackException;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.PlayerMessage;
import androidx.media3.exoplayer.Renderer;
import androidx.media3.exoplayer.SeekParameters;
import androidx.media3.exoplayer.analytics.AnalyticsCollector;
import androidx.media3.exoplayer.analytics.AnalyticsListener;
import androidx.media3.exoplayer.image.ImageOutput;
import androidx.media3.exoplayer.source.MediaSource;
import androidx.media3.exoplayer.source.ShuffleOrder;
import androidx.media3.exoplayer.source.TrackGroupArray;
import androidx.media3.exoplayer.trackselection.TrackSelectionArray;
import androidx.media3.exoplayer.trackselection.TrackSelector;
import androidx.media3.exoplayer.video.VideoFrameMetadataListener;
import androidx.media3.exoplayer.video.spherical.CameraMotionListener;
import java.util.List;

/**
 * An abstract {@link ExoPlayer} implementation that throws {@link UnsupportedOperationException}
 * from every method.
 */
@UnstableApi
public class StubExoPlayer extends StubPlayer implements ExoPlayer {

  /**
   * @deprecated Use {@link ExoPlayer}, as the {@link AudioComponent} methods are defined by that
   *     interface.
   */
  @SuppressWarnings("deprecation") // Returning deprecated type
  @Override
  @Deprecated
  public AudioComponent getAudioComponent() {
    throw new UnsupportedOperationException();
  }

  /**
   * @deprecated Use {@link ExoPlayer}, as the {@link VideoComponent} methods are defined by that
   *     interface.
   */
  @SuppressWarnings("deprecation") // Returning deprecated type
  @Override
  @Deprecated
  public VideoComponent getVideoComponent() {
    throw new UnsupportedOperationException();
  }

  /**
   * @deprecated Use {@link Player}, as the {@link TextComponent} methods are defined by that
   *     interface.
   */
  @SuppressWarnings("deprecation") // Returning deprecated type
  @Override
  @Deprecated
  public TextComponent getTextComponent() {
    throw new UnsupportedOperationException();
  }

  /**
   * @deprecated Use {@link Player}, as the {@link DeviceComponent} methods are defined by that
   *     interface.
   */
  @SuppressWarnings("deprecation") // Returning deprecated type
  @Override
  @Deprecated
  public DeviceComponent getDeviceComponent() {
    throw new UnsupportedOperationException();
  }

  @Override
  public Looper getPlaybackLooper() {
    throw new UnsupportedOperationException();
  }

  @Override
  public Clock getClock() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void addAudioOffloadListener(AudioOffloadListener listener) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void removeAudioOffloadListener(AudioOffloadListener listener) {
    throw new UnsupportedOperationException();
  }

  @Override
  public AnalyticsCollector getAnalyticsCollector() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void addAnalyticsListener(AnalyticsListener listener) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void removeAnalyticsListener(AnalyticsListener listener) {
    throw new UnsupportedOperationException();
  }

  @Override
  public ExoPlaybackException getPlayerError() {
    throw new UnsupportedOperationException();
  }

  /**
   * @deprecated Use {@link #setMediaSource(MediaSource)} and {@link #prepare()} instead.
   */
  @Deprecated
  @Override
  public void prepare(MediaSource mediaSource) {
    throw new UnsupportedOperationException();
  }

  /**
   * @deprecated Use {@link #setMediaSource(MediaSource, boolean)} and {@link #prepare()} instead.
   */
  @Deprecated
  @Override
  public void prepare(MediaSource mediaSource, boolean resetPosition, boolean resetState) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setPreloadConfiguration(PreloadConfiguration preloadConfiguration) {
    throw new UnsupportedOperationException();
  }

  @Override
  public PreloadConfiguration getPreloadConfiguration() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setMediaSource(MediaSource mediaSource) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setMediaSource(MediaSource mediaSource, long startPositionMs) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setMediaSource(MediaSource mediaSource, boolean resetPosition) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setMediaSources(List<MediaSource> mediaSources) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setMediaSources(List<MediaSource> mediaSources, boolean resetPosition) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setMediaSources(
      List<MediaSource> mediaSources, int startMediaItemIndex, long startPositionMs) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void addMediaSource(MediaSource mediaSource) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void addMediaSource(int index, MediaSource mediaSource) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void addMediaSources(List<MediaSource> mediaSources) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void addMediaSources(int index, List<MediaSource> mediaSources) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setShuffleOrder(ShuffleOrder shuffleOrder) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setAudioSessionId(int audioSessionId) {
    throw new UnsupportedOperationException();
  }

  @Override
  public int getAudioSessionId() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setAuxEffectInfo(AuxEffectInfo auxEffectInfo) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void clearAuxEffectInfo() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setPreferredAudioDevice(@Nullable AudioDeviceInfo audioDeviceInfo) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setSkipSilenceEnabled(boolean skipSilenceEnabled) {
    throw new UnsupportedOperationException();
  }

  @Override
  public boolean getSkipSilenceEnabled() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setVideoEffects(List<Effect> videoEffects) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setVideoScalingMode(int videoScalingMode) {
    throw new UnsupportedOperationException();
  }

  @Override
  public int getVideoScalingMode() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setVideoChangeFrameRateStrategy(int videoChangeFrameRateStrategy) {
    throw new UnsupportedOperationException();
  }

  @Override
  public int getVideoChangeFrameRateStrategy() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setVideoFrameMetadataListener(VideoFrameMetadataListener listener) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void clearVideoFrameMetadataListener(VideoFrameMetadataListener listener) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setCameraMotionListener(CameraMotionListener listener) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void clearCameraMotionListener(CameraMotionListener listener) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setSeekParameters(@Nullable SeekParameters seekParameters) {
    throw new UnsupportedOperationException();
  }

  @Override
  public SeekParameters getSeekParameters() {
    throw new UnsupportedOperationException();
  }

  @Override
  public PlayerMessage createMessage(PlayerMessage.Target target) {
    throw new UnsupportedOperationException();
  }

  @Override
  public int getRendererCount() {
    throw new UnsupportedOperationException();
  }

  @Override
  public int getRendererType(int index) {
    throw new UnsupportedOperationException();
  }

  @Override
  public Renderer getRenderer(int index) {
    throw new UnsupportedOperationException();
  }

  @Override
  @Nullable
  public TrackSelector getTrackSelector() {
    throw new UnsupportedOperationException();
  }

  /**
   * @deprecated Use {@link #getCurrentTracks()}.
   */
  @Deprecated
  @Override
  public TrackGroupArray getCurrentTrackGroups() {
    throw new UnsupportedOperationException();
  }

  /**
   * @deprecated Use {@link #getCurrentTracks()}.
   */
  @Deprecated
  @Override
  public TrackSelectionArray getCurrentTrackSelections() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setForegroundMode(boolean foregroundMode) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems) {
    throw new UnsupportedOperationException();
  }

  @Override
  public boolean getPauseAtEndOfMediaItems() {
    throw new UnsupportedOperationException();
  }

  @Nullable
  @Override
  public Format getAudioFormat() {
    throw new UnsupportedOperationException();
  }

  @Nullable
  @Override
  public Format getVideoFormat() {
    throw new UnsupportedOperationException();
  }

  @Nullable
  @Override
  public DecoderCounters getAudioDecoderCounters() {
    throw new UnsupportedOperationException();
  }

  @Nullable
  @Override
  public DecoderCounters getVideoDecoderCounters() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setWakeMode(int wakeMode) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setPriority(@C.Priority int priority) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager) {
    throw new UnsupportedOperationException();
  }

  @Override
  public boolean isSleepingForOffload() {
    throw new UnsupportedOperationException();
  }

  @Override
  public boolean isTunnelingEnabled() {
    throw new UnsupportedOperationException();
  }

  @Override
  public boolean isReleased() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setImageOutput(@Nullable ImageOutput imageOutput) {
    throw new UnsupportedOperationException();
  }
}