-
public class NativeVideoDelegateA delegated object used to handle the majority of the functionality for the "Native" video view implementation to simplify support for both the android.view.TextureView and android.view.SurfaceView implementations
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumNativeVideoDelegate.Statepublic interfaceNativeVideoDelegate.Callbackpublic classNativeVideoDelegate.InternalListeners
-
Field Summary
Fields Modifier and Type Field Description protected ListenerMuxlistenerMuxprotected MediaPlayer.OnCompletionListeneronCompletionListenerprotected MediaPlayer.OnPreparedListeneronPreparedListenerprotected MediaPlayer.OnBufferingUpdateListeneronBufferingUpdateListenerprotected MediaPlayer.OnSeekCompleteListeneronSeekCompleteListenerprotected MediaPlayer.OnErrorListeneronErrorListenerprotected MediaPlayer.OnInfoListeneronInfoListener
-
Constructor Summary
Constructors Constructor Description NativeVideoDelegate(Context context, NativeVideoDelegate.Callback callback, ClearableSurface clearableSurface)
-
Method Summary
Modifier and Type Method Description voidstart()voidpause()longgetDuration()longgetCurrentPosition()floatgetVolume()booleansetVolume(float volume)voidseekTo(long milliseconds)booleanisPlaying()intgetBufferPercentage()WindowInfogetWindowInfo()booleansetPlaybackSpeed(float speed)floatgetPlaybackSpeed()voidstopPlayback(boolean clearSurface)Performs the functionality to stop the video in playback voidsuspend()Cleans up the resources being held. booleanrestart()voidsetVideoURI(Uri uri, Map<String, String> headers)Sets video URI using specific headers. voidonSurfaceSizeChanged(int width, int height)voidonSurfaceReady(Surface surface)voidsetListenerMux(ListenerMux listenerMux)voidsetOnCompletionListener(MediaPlayer.OnCompletionListener listener)Register a callback to be invoked when the end of a media file has been reached during playback. voidsetOnPreparedListener(MediaPlayer.OnPreparedListener listener)Register a callback to be invoked when the media file is loaded and ready to go. voidsetOnBufferingUpdateListener(MediaPlayer.OnBufferingUpdateListener listener)Register a callback to be invoked when the status of a network stream's buffer has changed. voidsetOnSeekCompleteListener(MediaPlayer.OnSeekCompleteListener listener)Register a callback to be invoked when a seek operation has been completed. voidsetOnErrorListener(MediaPlayer.OnErrorListener listener)Register a callback to be invoked when an error occurs during playback or setup. voidsetOnInfoListener(MediaPlayer.OnInfoListener listener)Register a callback to be invoked when an informational event occurs during playback or setup. -
-
Constructor Detail
-
NativeVideoDelegate
NativeVideoDelegate(Context context, NativeVideoDelegate.Callback callback, ClearableSurface clearableSurface)
-
-
Method Detail
-
start
void start()
-
pause
void pause()
-
getDuration
long getDuration()
-
getCurrentPosition
long getCurrentPosition()
-
getVolume
float getVolume()
-
setVolume
boolean setVolume(float volume)
-
seekTo
void seekTo(long milliseconds)
-
isPlaying
boolean isPlaying()
-
getBufferPercentage
int getBufferPercentage()
-
getWindowInfo
@Nullable() WindowInfo getWindowInfo()
-
setPlaybackSpeed
boolean setPlaybackSpeed(float speed)
-
getPlaybackSpeed
float getPlaybackSpeed()
-
stopPlayback
void stopPlayback(boolean clearSurface)
Performs the functionality to stop the video in playback
- Parameters:
clearSurface-trueif the surface should be cleared
-
suspend
void suspend()
Cleans up the resources being held. This should only be called when destroying the video view
-
restart
boolean restart()
-
setVideoURI
void setVideoURI(Uri uri, Map<String, String> headers)
Sets video URI using specific headers.
- Parameters:
uri- The Uri for the video to playheaders- The headers for the URI request.
-
onSurfaceSizeChanged
void onSurfaceSizeChanged(int width, int height)
-
onSurfaceReady
void onSurfaceReady(Surface surface)
-
setListenerMux
void setListenerMux(ListenerMux listenerMux)
-
setOnCompletionListener
void setOnCompletionListener(MediaPlayer.OnCompletionListener listener)
Register a callback to be invoked when the end of a media file has been reached during playback.
- Parameters:
listener- The callback that will be run
-
setOnPreparedListener
void setOnPreparedListener(MediaPlayer.OnPreparedListener listener)
Register a callback to be invoked when the media file is loaded and ready to go.
- Parameters:
listener- The callback that will be run
-
setOnBufferingUpdateListener
void setOnBufferingUpdateListener(MediaPlayer.OnBufferingUpdateListener listener)
Register a callback to be invoked when the status of a network stream's buffer has changed.
- Parameters:
listener- the callback that will be run.
-
setOnSeekCompleteListener
void setOnSeekCompleteListener(MediaPlayer.OnSeekCompleteListener listener)
Register a callback to be invoked when a seek operation has been completed.
- Parameters:
listener- the callback that will be run
-
setOnErrorListener
void setOnErrorListener(MediaPlayer.OnErrorListener listener)
Register a callback to be invoked when an error occurs during playback or setup. If no listener is specified, or if the listener returned false, TextureVideoView will inform the user of any errors.
- Parameters:
listener- The callback that will be run
-
setOnInfoListener
void setOnInfoListener(MediaPlayer.OnInfoListener listener)
Register a callback to be invoked when an informational event occurs during playback or setup.
- Parameters:
listener- The callback that will be run
-
-
-
-