Class Youtube
- All Implemented Interfaces:
HasAttribute<Youtube>,HasClassName<Youtube>,HasStyle<Youtube>
For instance, to embed a youtube video in your application you can do the following:
Youtube youtube = new Youtube();
youtube.setVideoId("youtube-video-id");
youtube.setAutoPlay(true);
youtube.setLoop(true);
youtube.setControls(false);
youtube.setMute(true);
- Author:
- Hyyan Abo Fakher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe type of the content that will load in the player. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddClassName(String... className) getAttribute(String attribute) Get the default language.getComputedStyle(String property) intgetEnd()Get the end time.Get the language.getList()Get the list.Get the list type.getMute()Get the mute property.Get the list of videos to play.intgetStart()Get the start time.getUrl()Get the URL of the video.Get the id of the youtube video.Check if the autoplay is enabled.Check if the load caption is enabled.Check if the controls are shown.Check if keyboard interactions are disabled.Check if the fullscreen button is enabled.isLoop()Check if the loop is enabled.Get the modestBranding property.Get the playsinline property.Check if the annotations are enabled.removeAttribute(String attribute) removeClassName(String... className) removeStyle(String property) setAttribute(String attribute, String value) setAutoPlay(Boolean autoplay) Enable or disable the autoplay.setCaption(Boolean showCaption) When enabled causes closed captions to be shown by default, even if the user has turned captions off.setCaptionLanguage(String language) Specifies the default language that the player will use to display captions.setControls(Boolean controls) Show or hide the player controls.setDisableKeyboard(Boolean disableKeyboard) Enable or disable the keyboard controls.setEnd(int end) Specifies the time, measured in seconds from the start of the video, when the player should stop playing the video.setFullScreenButton(Boolean fullScreen) Enable or disable the fullscreen button.setLanguage(String language) Sets the player's interface language.The list option, in conjunction with thesetListType(ListType)option, identifies the content that will load in the player.setListType(Youtube.ListType listType) The listType option, in conjunction with thelistoption, identifies the content that will load in the player.Automatically play the video again and again.setModestBranding(Boolean modestBranding) A Boolean value that indicates whether the YouTube player does not show a YouTube logo.Set the mute property.setPlaylist(String playlist) Specifies a comma-separated list of video IDs to play.setPlaysInline(Boolean playsinline) Controls whether videos play inline or fullscreen on iOS.setShowAnnotations(Boolean showAnnotations) Enable or disable the video annotations.setStart(int start) Set the start time.setVideoId(String id) Specifies the ID of the YouTube video to be played.Methods inherited from class org.dwcj.component.element.ElementComposite
addEventListener, addEventListener, get, get, get, getElement, getEventListeners, getNodeName, initBoundComponent, set, setMethods inherited from class org.dwcj.component.Composite
getBoundComponent, getClientComponentId, isAttached, isDestroyed, onCreate, onDestroy, onDidCreate, onDidDestroy, whenAttachedMethods inherited from class org.dwcj.component.Component
addLifecycleObserver, create, destroy, getComponentId, getName, getUserData, getWindow, onAttach, removeLifecycleObserver, setName, setUserData
-
Constructor Details
-
Youtube
public Youtube()Create a new youtube component. -
Youtube
Create a new youtube component with the given id.- Parameters:
id- the id of the youtube video
-
-
Method Details
-
setVideoId
Specifies the ID of the YouTube video to be played.- Parameters:
id- the id of the youtube video- Returns:
- the youtube component
-
getVideoId
Get the id of the youtube video.- Returns:
- the id of the youtube video
-
setAutoPlay
Enable or disable the autoplay.Specifies whether the initial video will automatically start to play when the player loads.
- Parameters:
autoplay- the autoplay property- Returns:
- the youtube component
-
isAutoPlay
Check if the autoplay is enabled.- Returns:
- true if the autoplay is enabled, false otherwise
-
setCaptionLanguage
Specifies the default language that the player will use to display captions.Set the option's value to an ISO 639-1 two-letter language code. If you use this option and also set the
showCaptionthen the player will show captions in the specified language when the player loads. If you do not also set theshowCaptionoption, then captions will not display by default, but will display in the specified language if the user opts to turn captions on.- Parameters:
language- the default language- Returns:
- the youtube component
-
getCaptionLanguage
Get the default language.- Returns:
- the default language
-
setCaption
When enabled causes closed captions to be shown by default, even if the user has turned captions off. The default behavior is based on user preference.- Parameters:
showCaption- the load caption property- Returns:
- the youtube component
-
isCaption
Check if the load caption is enabled.- Returns:
- true if the load caption is enabled, false otherwise
-
setControls
Show or hide the player controls.- Parameters:
controls- when true, the player controls are shown, hidden otherwise.- Returns:
- the youtube component
-
isControls
Check if the controls are shown.- Returns:
- true if the controls are shown, false otherwise
-
setDisableKeyboard
Enable or disable the keyboard controls.- Parameters:
disableKeyboard- when true causes the player to not respond to keyboard controls.- Returns:
- the youtube component
-
isDisableKeyboard
Check if keyboard interactions are disabled.- Returns:
- the disableKeyboard property
-
setEnd
Specifies the time, measured in seconds from the start of the video, when the player should stop playing the video.- Parameters:
end- the end time- Returns:
- the youtube component
-
getEnd
public int getEnd()Get the end time.- Returns:
- the end time
-
setFullScreenButton
Enable or disable the fullscreen button.- Parameters:
fullScreen- when false, prevents the fullscreen button from displaying in the player. by default the button will display.- Returns:
- the youtube component
-
isFullScreenButton
Check if the fullscreen button is enabled.- Returns:
- true if the fullscreen button is enabled, false otherwise
-
setLanguage
Sets the player's interface language.The option value is an ISO 639-1 two-letter language code or a fully specified locale. For example,
frandfr-caare both valid values. Other language input codes, such asIETFlanguage tags (BCP 47) might also be handled properly. The interface language is used for tooltips in the player and also affects the default caption track. Note that YouTube might select a different caption track language for a particular user based on the user's individual language preferences and the availability of caption tracks.- Parameters:
language- the language- Returns:
- the youtube component
-
getLanguage
Get the language.- Returns:
- the language
- See Also:
-
setShowAnnotations
Enable or disable the video annotations.- Parameters:
showAnnotations- true to show the annotations, false otherwise to hide.- Returns:
- the youtube component
-
isShowAnnotations
Check if the annotations are enabled.- Returns:
- true if the annotations are enabled, false otherwise
-
setList
The list option, in conjunction with thesetListType(ListType)option, identifies the content that will load in the player.- Parameters:
list- the list- Returns:
- the youtube component
-
getList
Get the list.- Returns:
- the list
-
setListType
The listType option, in conjunction with thelistoption, identifies the content that will load in the player.- Parameters:
listType- the list type- Returns:
- the youtube component
-
getListType
Get the list type.- Returns:
- the list type
-
setLoop
Automatically play the video again and again.In the case of a single video player, enabling the option causes the player to play the initial video again and again. In the case of a playlist player the player plays the entire playlist and then starts again at the first video.
- Parameters:
loop- the loop property- Returns:
- the youtube component
-
isLoop
Check if the loop is enabled.- Returns:
- true if the loop is enabled, false otherwise
-
setModestBranding
A Boolean value that indicates whether the YouTube player does not show a YouTube logo.When true then prevents the YouTube logo from displaying in the control bar. Note that a small YouTube text label will still display in the upper-right corner of a paused video when the user's mouse pointer hovers over the player.
- Parameters:
modestBranding- when true, the YouTube logo is not shown, shown otherwise.- Returns:
- the youtube component
-
isModestBranding
Get the modestBranding property.- Returns:
- the modestBranding property
-
setPlaylist
Specifies a comma-separated list of video IDs to play.If you specify a value, the first video that plays will be the video id specified, and the videos specified in the playlist parameter will play thereafter.
- Parameters:
playlist- the playlist property- Returns:
- the youtube component
-
getPlaylist
Get the list of videos to play.- Returns:
- the playlist property
-
setPlaysInline
Controls whether videos play inline or fullscreen on iOS.when false, then results in fullscreen playback. This is currently the default value. when true, then results in inline playback for mobile browsers and for WebViews created with the
allowsInlineMediaPlaybackproperty set to YES.- Parameters:
playsinline- true to play inline, false otherwise- Returns:
- the youtube component
-
isPlaysInline
Get the playsinline property.- Returns:
- the playsinline property
-
setStart
Set the start time.Causes the player to begin playing the video at the given number of seconds from the start of the video.
- Parameters:
start- the start time- Returns:
- the youtube component
-
getStart
public int getStart()Get the start time.- Returns:
- the start time
-
setMute
Set the mute property.- Parameters:
mute- the mute property- Returns:
- the youtube component
-
getMute
Get the mute property.- Returns:
- the mute property
-
getUrl
Get the URL of the video.- Returns:
- the URL of the video
-
addClassName
- Specified by:
addClassNamein interfaceHasClassName<Youtube>
-
removeClassName
- Specified by:
removeClassNamein interfaceHasClassName<Youtube>
-
setStyle
-
getStyle
-
removeStyle
- Specified by:
removeStylein interfaceHasStyle<Youtube>
-
getComputedStyle
- Specified by:
getComputedStylein interfaceHasStyle<Youtube>
-
getAttribute
- Specified by:
getAttributein interfaceHasAttribute<Youtube>
-
setAttribute
- Specified by:
setAttributein interfaceHasAttribute<Youtube>
-
removeAttribute
- Specified by:
removeAttributein interfaceHasAttribute<Youtube>
-