Class MediaComponent
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- org.apache.wicket.markup.html.media.MediaComponent
-
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IMetadataContext<Serializable,Component>
,IHeaderContributor
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
public abstract class MediaComponent extends WebMarkupContainer
The media component is used to provide basic functionality to the video and audio component.- Since:
- 7.0.0
- Author:
- Tobias Soloschenko, Andrew Lombardi
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MediaComponent.Cors
To be used for the crossorigin attributestatic class
MediaComponent.Preload
To be used for the preload attribute
-
Field Summary
-
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING, RFLAG_CONTAINER_HAS_REMOVALS
-
-
Constructor Summary
Constructors Constructor Description MediaComponent(String id)
Constructor.MediaComponent(String id, String url)
Creates a media componentMediaComponent(String id, IModel<?> model)
Constructor.MediaComponent(String id, IModel<?> model, String url)
Creates a media componentMediaComponent(String id, IModel<?> model, String url, PageParameters pageParameters)
Creates a media componentMediaComponent(String id, IModel<?> model, ResourceReference resourceReference)
Creates a media componentMediaComponent(String id, IModel<?> model, ResourceReference resourceReference, PageParameters pageParameters)
Creates a media componentMediaComponent(String id, ResourceReference resourceReference)
Creates a media componentMediaComponent(String id, ResourceReference resourceReference, PageParameters pageParameters)
Creates a media component
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MediaComponent.Cors
getCrossOrigin()
Gets the cross origin settingsString
getEndTime()
Gets the position at which the media component stops the playbackString
getMediaGroup()
Gets the media group.PageParameters
getPageParameters()
Gets the page parameter applied to the URL of the media componentMediaComponent.Preload
getPreload()
The type of preloadString
getStartTime()
Gets the position at which the media component starts the playbackString
getType()
Gets the typeboolean
hasControls()
If the controls are going to be displayedboolean
isAutoplay()
If the playback is autoplayed on loadboolean
isLooping()
If the playback is loopedboolean
isMuted()
If the playback is muted initiallyprotected void
onComponentTag(ComponentTag tag)
Processes the component tag.void
setAutoplay(boolean autoplay)
Sets the playback to be autoplayed on loadvoid
setControls(Boolean controls)
Sets if the controls are going to be displayedvoid
setCrossOrigin(MediaComponent.Cors crossOrigin)
Sets the cross origin settings
ANONYMOUS: Cross-origin CORS requests for the element will not have the credentials flag set.
USER_CREDENTIALS: Cross-origin CORS requests for the element will have the credentials flag set.
NO_CORS: The empty string is also a valid keyword, and maps to the Anonymous state.void
setEndTime(String endTime)
Sets the position at which the media component stops the playback
t=10,20
t=npt:10,20
t=120s,121.5s
t=npt:120,0:02:01.5
t=smpte-30:0:02:00,0:02:01:15
t=smpte-25:0:02:00:00,0:02:01:12.1
t=clock:20090726T111901Z,20090726T121901Zvoid
setLooping(boolean loop)
Sets the playback to be loopedvoid
setMediaGroup(String mediaGroup)
Sets the media groupvoid
setMuted(boolean muted)
Sets the playback muted initiallyvoid
setPageParameters(PageParameters pageParameters)
Sets the page parameter applied to the URL of the media componentvoid
setPreload(MediaComponent.Preload preload)
Sets the type of preload.void
setStartTime(String startTime)
Sets the position at which the media component starts the playback
t=10,20
t=npt:10,20
t=120s,121.5s
t=npt:120,0:02:01.5
t=smpte-30:0:02:00,0:02:01:15
t=smpte-25:0:02:00:00,0:02:01:12.1
t=clock:20090726T111901Z,20090726T121901Zvoid
setType(String type)
Sets the type
* The following list shows some examples of how to use the codecs= MIME parameter in the type attribute.
H.264 Constrained baseline profile video (main and extended video compatible) level 3 and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
H.264 Extended profile video (baseline-compatible) level 3 and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="avc1.58A01E, mp4a.40.2"'>
H.264 Main profile video level 3 and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'>
H.264 'High' profile video (incompatible with main, baseline, or extended profiles) level 3 and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="avc1.64001E, mp4a.40.2"'>
MPEG-4 Visual Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="mp4v.20.8, mp4a.40.2"'>
MPEG-4 Advanced Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="mp4v.20.240, mp4a.40.2"'>
MPEG-4 Visual Simple Profile Level 0 video and AMR audio in 3GPP container
<source src='video.3gp' type='video/3gpp; codecs="mp4v.20.8, samr"'>
Theora video and Vorbis audio in Ogg container
<source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'>
Theora video and Speex audio in Ogg container
<source src='video.ogv' type='video/ogg; codecs="theora, speex"'>
Vorbis audio alone in Ogg container
<source src='audio.ogg' type='audio/ogg; codecs=vorbis'>
Speex audio alone in Ogg container
<source src='audio.spx' type='audio/ogg; codecs=speex'>
FLAC audio alone in Ogg container
<source src='audio.oga' type='audio/ogg; codecs=flac'>
Dirac video and Vorbis audio in Ogg container
<source src='video.ogv' type='video/ogg; codecs="dirac, vorbis"'>
Theora video and Vorbis audio in Matroska container
<source src='video.mkv' type='video/x-matroska; codecs="theora, vorbis"'>-
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
-
Methods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onComponentTagBody, onDetach, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
-
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMarkupTag, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
MediaComponent
public MediaComponent(String id)
Constructor.- Parameters:
id
- The component id
-
MediaComponent
public MediaComponent(String id, IModel<?> model)
Constructor.- Parameters:
id
- The component idmodel
- The component model
-
MediaComponent
public MediaComponent(String id, ResourceReference resourceReference)
Creates a media component- Parameters:
id
- The component idresourceReference
- the resource reference of the media file
-
MediaComponent
public MediaComponent(String id, IModel<?> model, ResourceReference resourceReference)
Creates a media component- Parameters:
id
- The component idmodel
- the internally used modelresourceReference
- the resource reference of the media file
-
MediaComponent
public MediaComponent(String id, ResourceReference resourceReference, PageParameters pageParameters)
Creates a media component- Parameters:
id
- The component idresourceReference
- the resource reference of the media filepageParameters
- the page parameters to be used to be prepended to the media URL
-
MediaComponent
public MediaComponent(String id, IModel<?> model, ResourceReference resourceReference, PageParameters pageParameters)
Creates a media component- Parameters:
id
- The component idmodel
- the internally used modelresourceReference
- the resource reference of the media filepageParameters
- the page parameters to be used to be prepended to the media URL
-
MediaComponent
public MediaComponent(String id, String url)
Creates a media component- Parameters:
id
- The component idurl
- an external URL to be used for the media component
-
MediaComponent
public MediaComponent(String id, IModel<?> model, String url)
Creates a media component- Parameters:
id
- The component idmodel
- the internally used modelurl
- an external URL to be used for the media component
-
MediaComponent
public MediaComponent(String id, IModel<?> model, String url, PageParameters pageParameters)
Creates a media component- Parameters:
id
- The component idmodel
- the internally used modelurl
- an external URL to be used for the media componentpageParameters
- the page parameters to be used to be prepended to the media URL
-
-
Method Detail
-
onComponentTag
protected void onComponentTag(ComponentTag tag)
Description copied from class:Component
Processes the component tag. Overrides of this method most likely should call the super implementation.- Overrides:
onComponentTag
in classComponent
- Parameters:
tag
- Tag to modify
-
isAutoplay
public boolean isAutoplay()
If the playback is autoplayed on load- Returns:
- If the playback is autoplayed on load
-
setAutoplay
public void setAutoplay(boolean autoplay)
Sets the playback to be autoplayed on load- Parameters:
autoplay
- If the playback is autoplayed on load
-
isLooping
public boolean isLooping()
If the playback is looped- Returns:
- If the playback is looped
-
setLooping
public void setLooping(boolean loop)
Sets the playback to be looped- Parameters:
loop
- If the playback is looped
-
getPageParameters
public PageParameters getPageParameters()
Gets the page parameter applied to the URL of the media component- Returns:
- the page parameter applied to the URL of the media component
-
setPageParameters
public void setPageParameters(PageParameters pageParameters)
Sets the page parameter applied to the URL of the media component- Parameters:
pageParameters
- the page parameter which are going to be applied to the URL of the media component
-
isMuted
public boolean isMuted()
If the playback is muted initially- Returns:
- If the playback is muted initially
-
setMuted
public void setMuted(boolean muted)
Sets the playback muted initially- Parameters:
muted
- If the playback is muted initially
-
hasControls
public boolean hasControls()
If the controls are going to be displayed- Returns:
- if the controls are going to displayed
-
setControls
public void setControls(Boolean controls)
Sets if the controls are going to be displayed- Parameters:
controls
- if the controls are going to displayed
-
getPreload
public MediaComponent.Preload getPreload()
The type of preload- Returns:
- the preload
- See Also:
setPreload(Preload)
-
setPreload
public void setPreload(MediaComponent.Preload preload)
Sets the type of preload.- none: Hints to the user agent that either the author does not expect the user to need the media resource, or that the server wants to minimise unnecessary traffic.
- metadata: Hints to the user agent that the author does not expect the user to need the media resource, but that fetching the resource metadata (dimensions, first frame, track list, duration, etc) is reasonable.
- auto: Hints to the user agent that the user agent can put the user's needs first without risk to the server, up to and including optimistically downloading the entire resource.
- Parameters:
preload
- the type of the preload
-
getStartTime
public String getStartTime()
Gets the position at which the media component starts the playback- Returns:
- the time at which position the media component starts the playback
- See Also:
setStartTime(String)
-
setStartTime
public void setStartTime(String startTime)
Sets the position at which the media component starts the playback
t=10,20
t=npt:10,20
t=120s,121.5s
t=npt:120,0:02:01.5
t=smpte-30:0:02:00,0:02:01:15
t=smpte-25:0:02:00:00,0:02:01:12.1
t=clock:20090726T111901Z,20090726T121901Z- Parameters:
startTime
- the time at which position the media component starts the playback
-
getEndTime
public String getEndTime()
Gets the position at which the media component stops the playback- Returns:
- the time at which position the media component stops the playback
- See Also:
setEndTime(String)
-
setEndTime
public void setEndTime(String endTime)
Sets the position at which the media component stops the playback
t=10,20
t=npt:10,20
t=120s,121.5s
t=npt:120,0:02:01.5
t=smpte-30:0:02:00,0:02:01:15
t=smpte-25:0:02:00:00,0:02:01:12.1
t=clock:20090726T111901Z,20090726T121901Z- Parameters:
endTime
- the time at which position the media component stops the playback
-
getMediaGroup
public String getMediaGroup()
Gets the media group.- Returns:
- the media group
-
setMediaGroup
public void setMediaGroup(String mediaGroup)
Sets the media group- Parameters:
mediaGroup
- to be set
-
getCrossOrigin
public MediaComponent.Cors getCrossOrigin()
Gets the cross origin settings- Returns:
- the cross origins settings
- See Also:
setCrossOrigin(Cors)
-
setCrossOrigin
public void setCrossOrigin(MediaComponent.Cors crossOrigin)
Sets the cross origin settings
ANONYMOUS: Cross-origin CORS requests for the element will not have the credentials flag set.
USER_CREDENTIALS: Cross-origin CORS requests for the element will have the credentials flag set.
NO_CORS: The empty string is also a valid keyword, and maps to the Anonymous state. The attribute's invalid value default is the Anonymous state. The missing value default, used when the attribute is omitted, is the No CORS state- Parameters:
crossOrigin
- the cross origins settings to set
-
getType
public String getType()
Gets the type- Returns:
- the type of this media element
- See Also:
setType(String)
-
setType
public void setType(String type)
Sets the type
* The following list shows some examples of how to use the codecs= MIME parameter in the type attribute.
H.264 Constrained baseline profile video (main and extended video compatible) level 3 and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
H.264 Extended profile video (baseline-compatible) level 3 and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="avc1.58A01E, mp4a.40.2"'>
H.264 Main profile video level 3 and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'>
H.264 'High' profile video (incompatible with main, baseline, or extended profiles) level 3 and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="avc1.64001E, mp4a.40.2"'>
MPEG-4 Visual Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="mp4v.20.8, mp4a.40.2"'>
MPEG-4 Advanced Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container
<source src='video.mp4' type='video/mp4; codecs="mp4v.20.240, mp4a.40.2"'>
MPEG-4 Visual Simple Profile Level 0 video and AMR audio in 3GPP container
<source src='video.3gp' type='video/3gpp; codecs="mp4v.20.8, samr"'>
Theora video and Vorbis audio in Ogg container
<source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'>
Theora video and Speex audio in Ogg container
<source src='video.ogv' type='video/ogg; codecs="theora, speex"'>
Vorbis audio alone in Ogg container
<source src='audio.ogg' type='audio/ogg; codecs=vorbis'>
Speex audio alone in Ogg container
<source src='audio.spx' type='audio/ogg; codecs=speex'>
FLAC audio alone in Ogg container
<source src='audio.oga' type='audio/ogg; codecs=flac'>
Dirac video and Vorbis audio in Ogg container
<source src='video.ogv' type='video/ogg; codecs="dirac, vorbis"'>
Theora video and Vorbis audio in Matroska container
<source src='video.mkv' type='video/x-matroska; codecs="theora, vorbis"'>- Parameters:
type
- the type of this media element
-
-