View Source

h2. Overview
_Since 4.0_

The ace:audioPlayer component renders an HTML5 {{<audio>}} element.

{tip}See the ICEfaces Showcase [Live Demo|http://icefaces-showcase.icesoft.org/showcase.jsf?grp=aceMenu&exp=audioPlayerBean] of this component, complete with source code.{tip}

h2. Getting Started

To start using the AudioPlayer component it is enough to specify an audio resource in the value attribute and the MIME type of such resource in the {{'type'}} attribute.

{code:xml}
<ace:audioPlayer id="audioPlayer"
value="#{bean.resourcePath}"
type="audio/mpeg" />
{code}

h2. Attributes

{tip:title=TagLib Documentation}This section covers attributes involved in the typical use-cases for this component. For reference, the complete taglib documentation for this component is available [here|http://res.icesoft.org/docs/v4_latest/ace/tld/ace/audioPlayer.html].{tip}

{panel}
The *value* attribute specifies an audio resource, which can either be a string representing a relative path to the audio file in the server, or a byte array that contains the encoded media, or a JSF resource.
{panel}

{panel}
The *controls* flag will render the playback controls if set to true.
{panel}

{panel}
The *loop* flag will cause the player to keep playing the media repeatedly.
{panel}

{panel}
The *autoplay* flag will cause the media to be played at the moment the component is loaded on the page.
{panel}

{panel}
If *muted* is set to true, the audio will be muted. Note that in many OS's, this attribute is not dynamic, meaning that it's not possible to change it programmatically. Once it is set to a certain value in the markup, it cannot be changed again at the markup level. However, the user will still be able to change it using the native player controls (if provided).
{panel}

{panel}
The *type* attribute is used to specify the MIME type of the media file.
{panel}

h2. Event Listeners

None.

h2. Client Behavior Events

None.

h2. JavaScript API

Not applicable.

h2. Keyboard Support

None.

h2. CSS Classes

The following markup represents the basic HTML structure of the component and the CSS classes it uses.

{code:xml}
<span class="mobi-audio [user defined classes]" style="[user defined styles]">
<audio></audio>
<a></a>
</span>
{code}
h2. Known Issues

* The ace:audioPlayer requires HTML5-compliant browser support and *IS NOT supported on IE8 or IE9* browsers.

h2. Other Notes

{panel}
Regarding MIME types, it is known that certain application servers have certain default MIME types that are not supported by some browsers. It is advised to use the most standard MIME types so the videos can be played in all browsers. These are: {{audio/aac}},
{{audio/mp4}}, {{audio/mpeg}}, {{audio/ogg}}, and {{audio/wav}}.
{panel}

h2. Additional Resources


h4. Tutorials

This component appears in the following ICEfaces tutorials:

*None*