Interface YouTubePlayer
-
- All Implemented Interfaces:
public interface YouTubePlayerUse this interface to control the playback of YouTube videos and to listen to their events.
-
-
Method Summary
Modifier and Type Method Description abstract UnitloadVideo(String videoId, Float startSeconds)Loads and automatically plays the video. abstract UnitcueVideo(String videoId, Float startSeconds)Loads the video's thumbnail and prepares the player to play the video. abstract Unitplay()abstract Unitpause()abstract UnitnextVideo()If the player is playing a playlist, play the next video. abstract UnitpreviousVideo()If the player is playing a playlist, play the previous video. abstract UnitplayVideoAt(Integer index)If the player is playing a playlist, play the video at position index. abstract UnitsetLoop(Boolean loop)If the player is playing a playlist, enable or disable looping of the playlist. abstract UnitsetShuffle(Boolean shuffle)If the player is playing a playlist, enable or disable shuffling of the playlist. abstract Unitmute()abstract UnitunMute()abstract UnitisMutedAsync(BooleanProvider callback)Returns true if the player is muted, false otherwise. abstract UnitsetVolume(Integer volumePercent)abstract UnitseekTo(Float time)abstract UnitsetPlaybackRate(PlayerConstants.PlaybackRate playbackRate)abstract UnittoggleFullscreen()Tries to enter or exit fullscreen in the player. abstract BooleanaddListener(YouTubePlayerListener listener)abstract BooleanremoveListener(YouTubePlayerListener listener)-
-
Method Detail
-
loadVideo
abstract Unit loadVideo(String videoId, Float startSeconds)
Loads and automatically plays the video.
- Parameters:
videoId- id of the videostartSeconds- the time from which the video should start playing
-
cueVideo
abstract Unit cueVideo(String videoId, Float startSeconds)
Loads the video's thumbnail and prepares the player to play the video. Does not automatically play the video.
- Parameters:
videoId- id of the videostartSeconds- the time from which the video should start playing
-
previousVideo
abstract Unit previousVideo()
If the player is playing a playlist, play the previous video.
-
playVideoAt
abstract Unit playVideoAt(Integer index)
If the player is playing a playlist, play the video at position index.
-
setLoop
abstract Unit setLoop(Boolean loop)
If the player is playing a playlist, enable or disable looping of the playlist.
-
setShuffle
abstract Unit setShuffle(Boolean shuffle)
If the player is playing a playlist, enable or disable shuffling of the playlist.
-
isMutedAsync
abstract Unit isMutedAsync(BooleanProvider callback)
Returns true if the player is muted, false otherwise.
-
setVolume
abstract Unit setVolume(Integer volumePercent)
- Parameters:
volumePercent- Integer between 0 and 100
-
setPlaybackRate
abstract Unit setPlaybackRate(PlayerConstants.PlaybackRate playbackRate)
-
toggleFullscreen
abstract Unit toggleFullscreen()
Tries to enter or exit fullscreen in the player.
Might require setting the
originparameter to "https://www.youtube.com".
-
addListener
abstract Boolean addListener(YouTubePlayerListener listener)
-
removeListener
abstract Boolean removeListener(YouTubePlayerListener listener)
-
-
-
-