Class AbstractYouTubePlayerListener
-
- All Implemented Interfaces:
-
com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.YouTubePlayerListener
public abstract class AbstractYouTubePlayerListener implements YouTubePlayerListener
Extend this class if you want to implement only some of the methods of YouTubePlayerListener
-
-
Constructor Summary
Constructors Constructor Description AbstractYouTubePlayerListener()
-
Method Summary
Modifier and Type Method Description UnitonReady(YouTubePlayer youTubePlayer)Called when the player is ready to play videos. UnitonStateChange(YouTubePlayer youTubePlayer, PlayerConstants.PlayerState state)Called every time the state of the player changes. UnitonPlaybackQualityChange(YouTubePlayer youTubePlayer, PlayerConstants.PlaybackQuality playbackQuality)Called every time the quality of the playback changes. UnitonPlaybackRateChange(YouTubePlayer youTubePlayer, PlayerConstants.PlaybackRate playbackRate)Called every time the speed of the playback changes. UnitonError(YouTubePlayer youTubePlayer, PlayerConstants.PlayerError error)Called when an error occurs in the player. UnitonApiChange(YouTubePlayer youTubePlayer)UnitonCurrentSecond(YouTubePlayer youTubePlayer, Float second)Called periodically by the player, the argument is the number of seconds that have been played. UnitonVideoDuration(YouTubePlayer youTubePlayer, Float duration)Called when the total duration of the video is loaded. UnitonVideoLoadedFraction(YouTubePlayer youTubePlayer, Float loadedFraction)Called periodically by the player, the argument is the percentage of the video that has been buffered. UnitonVideoId(YouTubePlayer youTubePlayer, String videoId)Called when the id of the current video is loaded -
-
Method Detail
-
onReady
Unit onReady(YouTubePlayer youTubePlayer)
Called when the player is ready to play videos. You should start using with the player only after this method is called.
- Parameters:
youTubePlayer- The YouTubePlayer object.
-
onStateChange
Unit onStateChange(YouTubePlayer youTubePlayer, PlayerConstants.PlayerState state)
Called every time the state of the player changes. Check PlayerConstants.PlayerState to see all the possible states.
- Parameters:
state- a state from PlayerConstants.PlayerState
-
onPlaybackQualityChange
Unit onPlaybackQualityChange(YouTubePlayer youTubePlayer, PlayerConstants.PlaybackQuality playbackQuality)
Called every time the quality of the playback changes. Check PlayerConstants.PlaybackQuality to see all the possible values.
- Parameters:
playbackQuality- a state from PlayerConstants.PlaybackQuality
-
onPlaybackRateChange
Unit onPlaybackRateChange(YouTubePlayer youTubePlayer, PlayerConstants.PlaybackRate playbackRate)
Called every time the speed of the playback changes. Check PlayerConstants.PlaybackRate to see all the possible values.
- Parameters:
playbackRate- a state from PlayerConstants.PlaybackRate
-
onError
Unit onError(YouTubePlayer youTubePlayer, PlayerConstants.PlayerError error)
Called when an error occurs in the player. Check PlayerConstants.PlayerError to see all the possible values.
- Parameters:
error- a state from PlayerConstants.PlayerError
-
onApiChange
Unit onApiChange(YouTubePlayer youTubePlayer)
-
onCurrentSecond
Unit onCurrentSecond(YouTubePlayer youTubePlayer, Float second)
Called periodically by the player, the argument is the number of seconds that have been played.
- Parameters:
second- current second of the playback
-
onVideoDuration
Unit onVideoDuration(YouTubePlayer youTubePlayer, Float duration)
Called when the total duration of the video is loaded. <br></br><br></br> Note that getDuration() will return 0 until the video's metadata is loaded, which normally happens just after the video starts playing.
- Parameters:
duration- total duration of the video
-
onVideoLoadedFraction
Unit onVideoLoadedFraction(YouTubePlayer youTubePlayer, Float loadedFraction)
Called periodically by the player, the argument is the percentage of the video that has been buffered.
- Parameters:
loadedFraction- a number between 0 and 1 that represents the percentage of the video that has been buffered.
-
onVideoId
Unit onVideoId(YouTubePlayer youTubePlayer, String videoId)
Called when the id of the current video is loaded
- Parameters:
videoId- the id of the video being played
-
-
-
-