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
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
To be used for the crossorigin attributestatic enum
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
ConstructorDescriptionMediaComponent
(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
Modifier and TypeMethodDescriptionGets the cross-origin settingsGets the position at which the media component stops the playbackGets the media group.Gets the page parameter applied to the URL of the media componentThe type of preloadGets the position at which the media component starts the playbackgetType()
Gets the typeboolean
If the controls are going to be displayedboolean
If the playback is autoplayed on loadboolean
If the playback is loopedboolean
isMuted()
If the playback is muted initiallyprotected void
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
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, 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 Details
-
MediaComponent
Constructor.- Parameters:
id
- The component id
-
MediaComponent
Constructor.- Parameters:
id
- The component idmodel
- The component model
-
MediaComponent
Creates a media component- Parameters:
id
- The component idresourceReference
- the resource reference of the media file
-
MediaComponent
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
Creates a media component- Parameters:
id
- The component idurl
- an external URL to be used for the media component
-
MediaComponent
Creates a media component- Parameters:
id
- The component idmodel
- the internally used modelurl
- an external URL to be used for the media component
-
MediaComponent
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 Details
-
onComponentTag
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
If the playback is autoplayed on load- Returns:
- If the playback is autoplayed on load
-
setAutoplay
Sets the playback to be autoplayed on load- Parameters:
autoplay
- If the playback is autoplayed on load
-
isLooping
If the playback is looped- Returns:
- If the playback is looped
-
setLooping
Sets the playback to be looped- Parameters:
loop
- If the playback is looped
-
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
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
If the playback is muted initially- Returns:
- If the playback is muted initially
-
setMuted
Sets the playback muted initially- Parameters:
muted
- If the playback is muted initially
-
hasControls
If the controls are going to be displayed- Returns:
- if the controls are going to displayed
-
setControls
Sets if the controls are going to be displayed- Parameters:
controls
- if the controls are going to displayed
-
getPreload
The type of preload- Returns:
- the preload
- See Also:
-
setPreload
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
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
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
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
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
Gets the media group.- Returns:
- the media group
-
setMediaGroup
Sets the media group- Parameters:
mediaGroup
- to be set
-
getCrossOrigin
Gets the cross-origin settings- Returns:
- the cross-origins settings
- See Also:
-
setCrossOrigin
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
Gets the type- Returns:
- the type of this media element
- See Also:
-
setType
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
-