Documentation · ViewHelper reference

XSD schema file | vhs master

Media / AudioViewHelper

Renders HTML code to embed a HTML5 audio player. NOTICE: This is all HTML5 and won't work on browsers like IE8 and below. Include some helper library like kolber.github.io/audiojs/ if you need to suport those. Source can be a single file, a CSV of files or an array of arrays with multiple sources for different audio formats. In the latter case provide array keys 'src' and 'type'. Providing an array of sources (even for a single source) is preferred as you can set the correct mime type of the audio which is otherwise guessed from the filename's extension. /

  • Tag usage example

    <v:media.audio src="[mixed]" relative="1" class="NULL" dir="NULL" id="NULL" lang="NULL" style="NULL" title="NULL" accesskey="NULL" tabindex="123" onclick="NULL" forceClosingTag="1" hideIfEmpty="1" contenteditable="NULL" contextmenu="NULL" draggable="NULL" dropzone="NULL" translate="NULL" spellcheck="NULL" hidden="NULL" width="123" height="123" autoplay="1" controls="1" loop="1" muted="1" poster="NULL" preload="'auto'" unsupported="NULL">
    	<!-- tag content - may be ignored! -->
    </v:media.audio>
  • Inline usage example

    {v:media.audio(src: [mixed], relative: 1, class: 'NULL', dir: 'NULL', id: 'NULL', lang: 'NULL', style: 'NULL', title: 'NULL', accesskey: 'NULL', tabindex: 123, onclick: 'NULL', forceClosingTag: 1, hideIfEmpty: 1, contenteditable: 'NULL', contextmenu: 'NULL', draggable: 'NULL', dropzone: 'NULL', translate: 'NULL', spellcheck: 'NULL', hidden: 'NULL', width: 123, height: 123, autoplay: 1, controls: 1, loop: 1, muted: 1, poster: 'NULL', preload: ''auto'', unsupported: 'NULL')}

Arguments

Argument Description Type
accesskey

Keyboard shortcut to access this element

string
autoplay

Specifies that the audio will start playing as soon as it is ready.

boolean
class

CSS class(es) for this element

string
contenteditable

Specifies whether the contents of the element are editable.

string
contextmenu

The value of the id attribute on the menu with which to associate the element as a context menu.

string
controls

Specifies that audio controls should be displayed (such as a play/pause button etc).

boolean
dir

Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left)

string
draggable

Specifies whether the element is draggable.

string
dropzone

Specifies what types of content can be dropped on the element, and instructs the UA about which actions to take with content when it is dropped on the element.

string
forceClosingTag

If TRUE, forces the created tag to use a closing tag. If FALSE, allows self-closing tags.

boolean
height

Sets the height of the audio player in pixels.

integer
hidden

Specifies that the element represents an element that is not yet, or is no longer, relevant.

string
hideIfEmpty

Hide the tag completely if there is no tag content

boolean
id

Unique (in this file) identifier for this HTML element.

string
lang

Language for this element. Use short names specified in RFC 1766

string
loop

Specifies that the audio will start over again, every time it is finished.

boolean
muted

Specifies that the audio output of the audio should be muted.

boolean
onclick

JavaScript evaluated for the onclick event

string
poster

Specifies an image to be shown while the audio is downloading, or until the user hits the play button.

string
preload

Specifies if and how the author thinks the audio should be loaded when the page loads. Can be "auto", "metadata" or "none".

string
relative

If FALSE media URIs are rendered absolute. URIs in backend mode are always absolute.

boolean
spellcheck

Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking.

string
src

Path to the media resource(s). Can contain single or multiple paths for videos/audio (either CSV, array or implementing Traversable).

mixed
style

Individual CSS styles for this element

string
tabindex

Specifies the tab order of this element

integer
title

Tooltip text of element

string
translate

Specifies whether an elements attribute values and contents of its children are to be translated when the page is localized, or whether to leave them unchanged.

string
unsupported

Add a message for old browsers like Internet Explorer 9 without audio support.

string
width

Sets the width of the audio player in pixels.

integer
Required attribute

Revision history

commit 3e3bdfa06ab7d88154944ba9527765400a481174
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jun 1 03:36:24 2014 +0200

    [FEATURE] Add Media/AudioViewhelper. The attributes like video without a playback screen

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to license.md file