-
public interface VideoViewApiThe basic APIs expected in the backing video view implementations to allow us to create an abstraction between the Native (Android) VideoView and the VideoView using the ExoPlayer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description interfaceVideoViewApi.OnSurfaceSizeChanged
-
Method Summary
Modifier and Type Method Description abstract intgetHeight()abstract intgetWidth()abstract voidsetVideoUri(Uri uri)abstract voidsetVideoUri(Uri uri, MediaSource mediaSource)abstract voidsetDrmCallback(MediaDrmCallback drmCallback)Sets the MediaDrmCallback to use when handling DRM for media. abstract floatgetVolume()abstract booleansetVolume(float volume)abstract voidseekTo(long milliseconds)abstract booleanisPlaying()abstract voidstart()abstract voidpause()abstract voidstopPlayback(boolean clearSurface)Performs the functionality to stop the video in playback abstract booleanrestart()Prepares the media previously specified for playback. abstract voidsuspend()abstract voidrelease()abstract longgetDuration()abstract longgetCurrentPosition()abstract intgetBufferedPercent()abstract WindowInfogetWindowInfo()abstract booleansetPlaybackSpeed(float speed)Sets the playback speed for this MediaPlayer. abstract floatgetPlaybackSpeed()abstract voidsetCaptionListener(CaptionListener listener)abstract booleantrackSelectionAvailable()abstract voidsetTrack(ExoMedia.RendererType type, int trackIndex)abstract voidsetTrack(ExoMedia.RendererType type, int groupIndex, int trackIndex)abstract intgetSelectedTrackIndex(ExoMedia.RendererType type, int groupIndex)abstract voidclearSelectedTracks(ExoMedia.RendererType type)Clear all selected tracks for the specified renderer. abstract Map<ExoMedia.RendererType, TrackGroupArray>getAvailableTracks()Retrieves a list of available tracks to select from. abstract voidsetRendererEnabled(ExoMedia.RendererType type, boolean enabled)Enables or disables the track associated with the type.abstract booleanisRendererEnabled(ExoMedia.RendererType type)Return true if at least one renderer for the given type is enabled abstract ScaleTypegetScaleType()abstract voidsetScaleType(ScaleType scaleType)abstract voidsetMeasureBasedOnAspectRatioEnabled(boolean doNotMeasureBasedOnAspectRatio)abstract voidsetVideoRotation(int rotation, boolean fromUser)Sets the rotation for the Video abstract voidsetOnTouchListener(View.OnTouchListener listener)abstract voidsetListenerMux(ListenerMux listenerMux)abstract voidonVideoSizeChanged(int width, int height, float pixelWidthHeightRatio)abstract voidsetRepeatMode(int repeatMode)-
-
Method Detail
-
getHeight
abstract int getHeight()
-
getWidth
abstract int getWidth()
-
setVideoUri
abstract void setVideoUri(Uri uri)
-
setVideoUri
abstract void setVideoUri(Uri uri, MediaSource mediaSource)
-
setDrmCallback
abstract void setDrmCallback(MediaDrmCallback drmCallback)
Sets the MediaDrmCallback to use when handling DRM for media.This should be called before specifying the videos uri or pathNOTE: DRM is only supported on API 18 +
- Parameters:
drmCallback- The callback to use when handling DRM media
-
getVolume
abstract float getVolume()
-
setVolume
abstract boolean setVolume(float volume)
-
seekTo
abstract void seekTo(long milliseconds)
-
isPlaying
abstract boolean isPlaying()
-
start
abstract void start()
-
pause
abstract void pause()
-
stopPlayback
abstract void stopPlayback(boolean clearSurface)
Performs the functionality to stop the video in playback
- Parameters:
clearSurface-trueif the surface should be cleared
-
restart
abstract boolean restart()
Prepares the media previously specified for playback. This should only be called afterthe playback has completed to restart playback from the beginning.
-
suspend
abstract void suspend()
-
release
abstract void release()
-
getDuration
abstract long getDuration()
-
getCurrentPosition
abstract long getCurrentPosition()
-
getBufferedPercent
abstract int getBufferedPercent()
-
getWindowInfo
@Nullable() abstract WindowInfo getWindowInfo()
-
setPlaybackSpeed
abstract boolean setPlaybackSpeed(float speed)
Sets the playback speed for this MediaPlayer.
- Parameters:
speed- The speed to play the media back at
-
getPlaybackSpeed
abstract float getPlaybackSpeed()
-
setCaptionListener
abstract void setCaptionListener(CaptionListener listener)
-
trackSelectionAvailable
abstract boolean trackSelectionAvailable()
-
setTrack
@Deprecated() abstract void setTrack(ExoMedia.RendererType type, int trackIndex)
-
setTrack
abstract void setTrack(ExoMedia.RendererType type, int groupIndex, int trackIndex)
-
getSelectedTrackIndex
abstract int getSelectedTrackIndex(ExoMedia.RendererType type, int groupIndex)
-
clearSelectedTracks
abstract void clearSelectedTracks(ExoMedia.RendererType type)
Clear all selected tracks for the specified renderer.
- Parameters:
type- The renderer type
-
getAvailableTracks
@Nullable() abstract Map<ExoMedia.RendererType, TrackGroupArray> getAvailableTracks()
Retrieves a list of available tracks to select from. Typically trackSelectionAvailable should be called before this.
-
setRendererEnabled
abstract void setRendererEnabled(ExoMedia.RendererType type, boolean enabled)
Enables or disables the track associated with the
type. Note, by default alltracks are enabled- Parameters:
type- The ExoMedia.RendererType to enable or disable the track forenabled-trueif the track should be enabled.
-
isRendererEnabled
abstract boolean isRendererEnabled(ExoMedia.RendererType type)
Return true if at least one renderer for the given type is enabled
- Parameters:
type- The renderer type
-
getScaleType
@NonNull() abstract ScaleType getScaleType()
-
setScaleType
abstract void setScaleType(ScaleType scaleType)
-
setMeasureBasedOnAspectRatioEnabled
abstract void setMeasureBasedOnAspectRatioEnabled(boolean doNotMeasureBasedOnAspectRatio)
-
setVideoRotation
abstract void setVideoRotation(int rotation, boolean fromUser)
Sets the rotation for the Video
- Parameters:
rotation- The rotation to apply to the videofromUser- True if the rotation was requested by the user, false if it is from a video configuration
-
setOnTouchListener
abstract void setOnTouchListener(View.OnTouchListener listener)
-
setListenerMux
abstract void setListenerMux(ListenerMux listenerMux)
-
onVideoSizeChanged
abstract void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio)
-
setRepeatMode
abstract void setRepeatMode(int repeatMode)
-
-
-
-