Audio"

From Documentation
Line 8: Line 8:
  
 
= Employment/Purpose =
 
= Employment/Purpose =
An <tt>audio</tt> component is used to play the audio at the browser. Like <tt>image</tt>, you could use the <tt>src</tt> property to specify an URL of an audio resource, or the <tt>setContent</tt> method to specify a dynamically generated audio.  
+
An <tt>audio</tt> component is used to play the audio at the browser. Like <tt>image</tt>, you could use the <tt>src</tt> property to specify an URL of an audio resource, or the <tt>setContent</tt> method to specify a dynamically generated audio. Developers might be able to control the play of an audio by the <tt>play</tt>, <tt>stop</tt> and <tt>pause</tt> methods.
  
 +
= Example =
 +
[[Image:ZKComRef_Audio_Example.png]]
  
 +
<source lang="xml" >
 +
<audio src="music.wav" controls="true"></audio>
 +
</source>
 +
The audio supports controls property since 7.0.0
 +
 +
= Supports HTML5 =
 +
The audio component has now been enhanced to support HTML 5, it includes the properties like <tt>autoplay</tt>, <tt>controls</tt>, <tt>loop</tt>, <tt>muted</tt> and <tt>preload</tt>.
 
  [Since 7.0.0]
 
  [Since 7.0.0]
the <tt>audio</tt> only works for browsers supporting HTML5 audio tag, it supports the properties like <tt>autoplay</tt>, <tt>controls</tt>, <tt>loop</tt>, <tt>muted</tt> and <tt>preload</tt>, and it could have multiple <tt>src</tt> attributes. Developers might be able to control the play of an audio by the <tt>play</tt>, <tt>stop</tt> and <tt>pause</tt> methods.
 
 
= Example =
 
[[Image:ZKComRef_Audio_Example.png]]
 
  
 +
= Multiple Sources=
 +
Because most browsers does not support all the audio format, so we could specify multiple source files in different formats for different browsers. For examples:
 
<source lang="xml" >
 
<source lang="xml" >
  <audio id="audio" src="music.wav, music.mp3, backup.ogg" controls="true"></audio>
+
  <audio src="music.wav, music.mp3, music.ogg" controls="true"></audio>
 
</source>
 
</source>
 +
[Since 7.0.0]
  
 
=Supported Events=
 
=Supported Events=

Revision as of 15:18, 22 October 2013

Audio

Employment/Purpose

An audio component is used to play the audio at the browser. Like image, you could use the src property to specify an URL of an audio resource, or the setContent method to specify a dynamically generated audio. Developers might be able to control the play of an audio by the play, stop and pause methods.

Example

ZKComRef Audio Example.png

 <audio src="music.wav" controls="true"></audio>
The audio supports controls property since 7.0.0

Supports HTML5

The audio component has now been enhanced to support HTML 5, it includes the properties like autoplay, controls, loop, muted and preload.

[Since 7.0.0]

Multiple Sources

Because most browsers does not support all the audio format, so we could specify multiple source files in different formats for different browsers. For examples:

 <audio src="music.wav, music.mp3, music.ogg" controls="true"></audio>
[Since 7.0.0]

Supported Events

Name
Event Type
None None

Supported Children

*NONE

Use Cases

Version Description Example Location
     

Version History

Last Update : 2013/10/22


Version Date Content
7.0.0 August, 2013 Audio now supports HTML 5



Last Update : 2013/10/22

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.