-
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 filehas been reached during playback. voidsetOnPreparedListener(MediaPlayer.OnPreparedListener listener)Register a callback to be invoked when the media fileis loaded and ready to go. voidsetOnBufferingUpdateListener(MediaPlayer.OnBufferingUpdateListener listener)Register a callback to be invoked when the status of a networkstream's buffer has changed. voidsetOnSeekCompleteListener(MediaPlayer.OnSeekCompleteListener listener)Register a callback to be invoked when a seek operation has beencompleted. voidsetOnErrorListener(MediaPlayer.OnErrorListener listener)Register a callback to be invoked when an error occursduring playback or setup. voidsetOnInfoListener(MediaPlayer.OnInfoListener listener)Register a callback to be invoked when an informational eventoccurs 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 whendestroying 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.Note that the cross domain redirection is allowed by default, but that can bechanged with key/value pairs through the headers parameter with"android-allow-cross-domain-redirect" as the key and "0" or "1" as the valueto disallow or allow cross domain redirection.
-
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 filehas 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 fileis 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 networkstream'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 beencompleted.
- Parameters:
listener- the callback that will be run
-
setOnErrorListener
void setOnErrorListener(MediaPlayer.OnErrorListener listener)
Register a callback to be invoked when an error occursduring playback or setup. If no listener is specified,or if the listener returned false, TextureVideoView will informthe 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 eventoccurs during playback or setup.
- Parameters:
listener- The callback that will be run
-
-
-
-