Oracle Fusion Middleware Tag Reference for Oracle ADF Faces
11g Release 2 (11.1.2.0.0)

E17491-02

<af:media>

af:media media media

UIComponent class: oracle.adf.view.rich.component.rich.output.RichMedia
Component type: oracle.adf.RichMedia

The media component displays media content, such as audio, video, or image in a player embedded in the user agent. The media control displays the media specified by the "source" attribute in the appropriate media player. If a particular media player is desired, it can be specified using the "player" attribute. The media control attempts to intelligently handle two tricky aspects of cross-platform media display--determining the best player to display the media, and sizing the media player.

Media Player Selection

The media control attempts to pick the appropriate media player using the following steps:

  1. If the primary MIME type of the content is "image", the built in user-agent support will be used.
  2. If a media player has been specified by the "player" attribute and that player is available on the user agent and can display the media resource, that player will be used.
  3. If one player is especially good at playing the media resource and that player is available on the user agent, that player will be used.
  4. If one player is especially dominant on the user agent and that player can play the media resource, that player will be used.
  5. the "link" player will be used.

Player Sizing

The media component supports two approaches to sizing the media control setting the "width" and "height" attributes, which specify the amount of space reserved on the user agent for the media control, and setting the "innerWidth" and "innerHeight" attributes, which specify the size of the media resource content. Since it is almost impossible to determine the correct width and height to use across different players and different player control configurations, specifying the "innerWidth" and "innerHeight" is the recommended strategy. If the size of the media control isn't specified by one of the above approaches, a default inner size, determined by the content type of the media resource, will be used. This works well for audio content, but can cause content to be clipped or occupy too much space for video content.

Behavior Of The Link Player

If the player type is "link" or the media component falls back on the link-player,then the behavior upon clicking the link depends upon the MIME type sent by the web server, for that particular media type. This is usually configured in the web.xml deployment descriptor or in the web server wide configuration file.Please see the servlet spec for more details.

 Example:
 <mime-mapping>
   <extension>wmv</extension>
   <mime-type>video/x-ms-wmv</mime-type>
 </mime-mapping> 

Geometry Management

Screen Shot(s)


media screenshot
A media component used to show a video.

Code Example(s)

This sample builds an media control, for playing a house music Windows Media file. The typical set of controls is displayed, and the control is sized just large enough to display the controls, since the default inner size of audio files is 0 by 0 pixels.

<af:media source="house.wma" />
   

Events

Type Phases Description
org.apache.myfaces.trinidad.event.AttributeChangeEvent Invoke Application,
Apply Request Values
Event delivered to describe an attribute change. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change event might include the width of a column that supported client-side resizing.

Attributes

Name Type Supports EL? Description
attributeChangeListener javax.el.MethodExpression Only EL a method reference to an attribute change listener. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change events might include the width of a column that supported client-side resizing.
autostart boolean Yes Default Value: false

a boolean value that controls whether the media resource loads and plays automatically without user initiation. When set to "true", the media resource will load and play as soon as possible.
binding oracle.adf.view.rich.component.rich.output.RichMedia Only EL an EL reference that will store the component instance on a bean. This can be used to give programmatic access to a component from a backing bean, or to move creation of the component to a backing bean.
clientComponent boolean Yes Default Value: false

whether a client-side component will be generated. A component may be generated whether or not this flag is set, but if client Javascript requires the component object, this must be set to true to guarantee the component's presence. Client component objects that are generated today by default may not be present in the future; setting this flag is the only way to guarantee a component's presence, and clients cannot rely on implicit behavior. However, there is a performance cost to setting this flag, so clients should avoid turning on client components unless absolutely necessary.
contentType String Yes the MIME type of the media content returned by the "source" URI. This attribute is used as a hint when determining which player to pick, how the controls of the player are to be configured, and the default size of the media player. If it isn't specified, an attempt will be made to derive this information from the extension of the source URI.
controls String Yes Valid Values: noneVisible, none, typical, all, minimal
Default Value: typical

the set of controls made available to the user for controlling the media playback. The actual set of controls displayed for the same value may differ between players. Likewise, the amount of space occupied by the controls will differ from media player to media player. This can cause problems if the size of the media control has been specified by the "width" and "height" attributes rather than "innerWidth" and "innerHeight".
  • "none"

    don't show any controls for the media player and don't allow control access through alternate means, such as context menus.

    This value is typically only used in kiosk-type applications where no user control over the playing of the media is allowed. It is typically used in conjunction with setting the "autostart" attribute to "true", and the "playCount" attribute to "0" to cause the media play immediately and then loop.

  • "noneVisible"

    don't show any controls for the media player but allow control access through alternate means, such as context menus.

    This value is typically only used in applications where user control over the playing of the media is allowed, but not encouraged. It is typically used in conjunction with setting the "autostart" attribute to "true", and the "playCount" attribute to "0" to cause the media to play immediately and then loop.

  • "minimal"

    show a minimal set of controls for playing media on the media player.

    This value gives users control over the most important media playing controls, while occupying the least amount of additional space on the user agent.

  • "typical"

    show the typical set of controls for playing media on the media player.

    This value, the default, gives users control over the most common media playing controls, without occupying an inordinate amount of extra space on the user agent.

  • "all"

    Show all available controls for playing media on the media player

    Using this setting can cause large amount of additional space to be required, depending on the media player used.

The default of this attribute is "typical".

customizationId String Yes This attribute is deprecated. The 'id' attribute should be used when applying persistent customizations. This attribute will be removed in the next release.
height String Yes the height in pixels to reserve for the media player plus its content. As the extra height needed for the media player controls can vary from media player to media player and depend on the controls displayed in the media player, it is recommended that the "innerHeight" attribute be used in preference to this attribute.

If both the "height" and "innerHeight" attributes are specified, the "height" attribute will be used.

If no height is specified, the height of the media control is determined by calculating the "innerHeight" and adding any extra height necessary to display the media player controls.

id String No the identifier for the component. The identifier must follow a subset of the syntax allowed in HTML:
  • Must not be a zero-length String.
  • First character must be an ASCII letter (A-Za-z) or an underscore ('_').
  • Subsequent characters must be an ASCII letter or digit (A-Za-z0-9), an underscore ('_'), or a dash ('-').
inlineStyle String Yes the CSS styles to use for this component. This is intended for basic style changes. The inlineStyle is a set of CSS styles that are applied to the root DOM element of the component. Be aware that because of browser CSS precedence rules, CSS rendered on a DOM element takes precedence over external stylesheets like the skin file. Therefore skins will not be able to override what you set on this attribute. If the inlineStyle's CSS properties do not affect the DOM element you want affected, then you will have to create a skin and use the skinning keys which are meant to target particular DOM elements, like ::label or ::icon-style.
innerHeight int Yes the height in pixels to reserve for the media player content. This will typically be set to the pixel height of the media resource to display.

If no "innerHeight" is specified, the "innerHeight" will be defaulted based on the content type of the media resource to play.

If both the "height" and "innerHeight" attributes are specified, the "height" attribute will be used.

innerWidth int Yes the width in pixels to reserve for the media player content. This will typically be set to the pixel width of the media resource to display.

If no "innerWidth" is specified, the "innerWidth" will be defaulted based on the content type of the media resource to play.

If both the "width" and "innerWidth" attributes are specified, the "width" attribute will be used.

partialTriggers String[] Yes the IDs of the components that should trigger a partial update. This component will listen on the trigger components. If one of the trigger components receives an event that will cause it to update in some way, this component will request to be updated too. Identifiers are relative to the source component (this component), and must account for NamingContainers. If your component is already inside of a naming container, you can use a single colon to start the search from the root of the page, or multiple colons to move up through the NamingContainers - "::" will pop out of the component's naming container (or itself if the component is a naming container) and begin the search from there, ":::" will pop out of two naming containers (including itself if the component is a naming container) and begin the search from there, etc.
playCount int Yes the number of times the media resource will play. If set to "0", the resource will loop until the user stops the playing.
player String Yes Valid Values: windows, quicktime, link, real

which media player to use to play the media resource. If possible, the media control will accomodate this request. However, if the requested player is not available on the user agent, or does not support playing the media resource, an alternate player will be used instead. In all cases, the "link" player is used as a fallback if no other player is available, or the requested player fails for some reason.
  • "none"

    use a link in the user agent page to launch the playing of the media resource.

    This player setting uses the least amount of space on the page and uses the user agent's built in content type mapping to determine how to display the media resource.

  • "quicktime"

    use the Apple QuickTime player.

  • "windows"

    use the Windows Media Player.

  • "real"

    use the Real Player.

rendered boolean Yes Default Value: true

whether the component is rendered. When set to false, no output will be delivered for this component (the component will not in any way be rendered, and cannot be made visible on the client). If you want to change a component's rendered attribute from false to true using PPR, set the partialTrigger attribute of its parent component so the parent refreshes and in turn will render this component.
shortDesc String Yes the short description of the component. This text is commonly used by user agents to display tooltip help text, in which case the behavior for the tooltip is controlled by the user agent, e.g. Firefox 2 truncates long tooltips. For form components, the shortDesc is displayed in a note window. For components that support the helpTopicId attribute it is recommended that helpTopicId is used as it is more flexible and is more accessibility-compliant.
source String Yes the URI specifying the location of the media resource. If no contentType is specified, the contentType will be inferred from the extension of the source attribute.
standbyText String Yes the message to display in the media player while the media resource is loading.
styleClass String Yes a CSS style class to use for this component. The style class can be defined in your jspx page or in a skinning CSS file, for example, or you can use one of our public style classes, like 'AFInstructionText'.
unsecure java.util.Set Yes A whitespace separated list of attributes whose values ordinarily can be set only on the server, but need to be settable on the client. Currently, this is supported only for the "disabled" attribute. Note that when you are able to set a property on the client, you will be allowed to by using the the .setProperty('attribute', newValue) method, but not the .setXXXAttribute(newValue) method. For example, if you have unsecure="disabled", then on the client you can use the method .setProperty('disabled', false), while the method .setDisabled(false) will not work and will provide a javascript error that setDisabled is not a function.
visible boolean Yes Default Value: true

the visibility of the component. If it is "false", the component will be hidden on the client. Unlike "rendered", this does not affect the lifecycle on the server - the component may have its bindings executed, etc. - and the visibility of the component can be toggled on and off on the client, or toggled with PPR. When "rendered" is false, the component will not in any way be rendered, and cannot be made visible on the client. In most cases, use the "rendered" property instead of the "visible" property.
Not supported on the following renderkits: org.apache.myfaces.trinidad.core
width String Yes the width in pixels to reserve for the media player plus its content. As the extra width needed for the media player controls can vary from media player to media player and depend on the controls displayed in the media player, it is recommended that the "innerWidth" attribute be used in preference to this attribute.

If both the "width" and "innerWidth" attributes are specified, the "width" attribute will be used.

If no width is specified, the width of the media control is determined by calculating the "innerWidth" and adding any extra width necessary to display the media player controls.