Interface YouTubePlayerListener
-
- All Implemented Interfaces:
public interface YouTubePlayerListener
-
-
Method Summary
Modifier and Type Method Description abstract UnitonReady(YouTubePlayer youTubePlayer)Called when the player is ready to play videos. abstract UnitonStateChange(YouTubePlayer youTubePlayer, PlayerConstants.PlayerState state)Called every time the state of the player changes. abstract UnitonPlaybackQualityChange(YouTubePlayer youTubePlayer, PlayerConstants.PlaybackQuality playbackQuality)Called every time the quality of the playback changes. abstract UnitonPlaybackRateChange(YouTubePlayer youTubePlayer, PlayerConstants.PlaybackRate playbackRate)Called every time the speed of the playback changes. abstract UnitonError(YouTubePlayer youTubePlayer, PlayerConstants.PlayerError error)Called when an error occurs in the player. abstract UnitonCurrentSecond(YouTubePlayer youTubePlayer, Float second)Called periodically by the player, the argument is the number of seconds that have been played. abstract UnitonVideoDuration(YouTubePlayer youTubePlayer, Float duration)Called when the total duration of the video is loaded. abstract UnitonVideoLoadedFraction(YouTubePlayer youTubePlayer, Float loadedFraction)Called periodically by the player, the argument is the percentage of the video that has been buffered. abstract UnitonVideoId(YouTubePlayer youTubePlayer, String videoId)Called when the id of the current video is loaded abstract UnitonApiChange(YouTubePlayer youTubePlayer)-
-
Method Detail
-
onReady
abstract 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
abstract 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
abstract 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
abstract 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
abstract 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
-
onCurrentSecond
abstract 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
abstract 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
abstract 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
abstract 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
-
onApiChange
abstract Unit onApiChange(YouTubePlayer youTubePlayer)
-
-
-
-