Package totalcross.ui.media
Class YoutubePlayer
- java.lang.Object
-
- totalcross.ui.media.YoutubePlayer
-
public class YoutubePlayer extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceYoutubePlayer.Callback
-
Field Summary
Fields Modifier and Type Field Description static intERROR_UNKNOWNUnknown error happened.static intERROR_VIDEO_NOT_FOUNDWhen the video couldn't be found.static intSTATE_BUFFERINGWhen the video is bufferingstatic intSTATE_CUEDWhen the video is cued.static intSTATE_ENDEDWhen the video ends.static intSTATE_PAUSEDWhen the video is paused.static intSTATE_PLAYINGWhen the video starts playing.static intSTATE_UNKNOWNUnknown state of the player.static intSTATE_UNSTARTEDWhen the video is not started yet.
-
Constructor Summary
Constructors Constructor Description YoutubePlayer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description YoutubePlayerautoPlay(boolean autoPlay)Sets the video to play automatically when it's loaded.YoutubePlayerend(int end)Sets the end point of the video.voidplay(java.lang.String id)Plays a video with the video id passed (value from v query parameter).voidplay(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.YoutubePlayerstart(int start)Sets the start point of the video.
-
-
-
Field Detail
-
STATE_UNSTARTED
public static final int STATE_UNSTARTED
When the video is not started yet.- See Also:
- Constant Field Values
-
STATE_ENDED
public static final int STATE_ENDED
When the video ends.- 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_CUED
public static final int STATE_CUED
When the video is cued.- 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
-
-
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.IOExceptionPlays 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.IOExceptionPlays 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
-
-