Class YoutubePlayer


  • public class YoutubePlayer
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  YoutubePlayer.Callback  
    • Constructor Summary

      Constructors 
      Constructor Description
      YoutubePlayer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      YoutubePlayer autoPlay​(boolean autoPlay)
      Sets the video to play automatically when it's loaded.
      YoutubePlayer end​(int end)
      Sets the end point of the video.
      void play​(java.lang.String id)
      Plays a video with the video id passed (value from v query parameter).
      void play​(java.lang.String id, YoutubePlayer.Callback callback)
      Plays a video with the video id passed and has a callback function that returns the state of the the player.
      YoutubePlayer start​(int start)
      Sets the start point of the video.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • STATE_UNSTARTED

        public static final int STATE_UNSTARTED
        When the video is not started yet.
        See Also:
        Constant Field Values
      • STATE_PLAYING

        public static final int STATE_PLAYING
        When the video starts playing.
        See Also:
        Constant Field Values
      • STATE_PAUSED

        public static final int STATE_PAUSED
        When the video is paused.
        See Also:
        Constant Field Values
      • STATE_BUFFERING

        public static final int STATE_BUFFERING
        When the video is buffering
        See Also:
        Constant Field Values
      • STATE_UNKNOWN

        public static final int STATE_UNKNOWN
        Unknown state of the player.
        See Also:
        Constant Field Values
      • ERROR_VIDEO_NOT_FOUND

        public static final int ERROR_VIDEO_NOT_FOUND
        When the video couldn't be found.
        See Also:
        Constant Field Values
      • ERROR_UNKNOWN

        public static final int ERROR_UNKNOWN
        Unknown error happened.
        See Also:
        Constant Field Values
    • Constructor Detail

      • YoutubePlayer

        public YoutubePlayer()
    • Method Detail

      • autoPlay

        public YoutubePlayer autoPlay​(boolean autoPlay)
        Sets the video to play automatically when it's loaded.
      • end

        public YoutubePlayer end​(int end)
        Sets the end point of the video.
        Parameters:
        end - the end point of the video in seconds.
      • start

        public YoutubePlayer start​(int start)
        Sets the start point of the video.
        Parameters:
        start - the start point of the video in seconds.
      • play

        public void play​(java.lang.String id)
                  throws java.io.IOException
        Plays a video with the video id passed (value from v query parameter).
        Parameters:
        url - the video id eg.: https://www.youtube.com/watch?v=xBM4luqmCKs.
        Throws:
        java.io.IOException
      • play

        public void play​(java.lang.String id,
                         YoutubePlayer.Callback callback)
                  throws java.io.IOException
        Plays a video with the video id passed and has a callback function that returns the state of the the player.
        Parameters:
        url - the video id eg.: https://www.youtube.com/watch?v=xBM4luqmCKs.
        callback - the YoutubePlayer.Callback
        Throws:
        java.io.IOException