//Audio Example
PlayButton.onclick = function() {
Audio1.play();
}
No edit summary |
No edit summary |
||
(16 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
[[file:Audio.jpg]] | [[file:Audio.jpg]] | ||
== Description == | |||
The Audio control is used to play a sound. The sound can be any common format, including mp3, ogg, wav and aac. | The Audio control is used to play a sound. The sound can be any common format, including mp3, ogg, uncompressed wav and aac. Not all formats will play back on an app which is saved to the Home screen. | ||
To add a sound to your app, choose the Audio icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need. Depending on the options you choose, the control may be invisible. | To add a sound to your app, choose the Audio icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need. Depending on the options you choose, the control may be invisible. | ||
' | Here's a excellent article on what can and cannot be done with iOS Audio: http://www.ibm.com/developerworks/library/wa-ioshtml5/ | ||
Standard | == Properties == | ||
Standard [[properties and methods|properties]] are supported, plus: | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| autoplay || Audio will start playing as soon as ready. | | autoplay || Audio will start playing as soon as ready. Not supported on iOS. | ||
|- | |- | ||
| controls || Controls will be displayed, such as a Play. | | controls || Controls will be displayed, such as a Play. | ||
Line 23: | Line 25: | ||
|} | |} | ||
== Methods == | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 31: | Line 33: | ||
|} | |} | ||
<tabber> | |||
JavaScript= | |||
<syntaxhighlight lang="JavaScript"> | |||
//Audio Example | |||
PlayButton.onclick = function() { | |||
Audio1.play(); | |||
} | |||
</syntaxhighlight> | |||
|-| | |||
BASIC= | |||
<syntaxhighlight lang="vb.net"> | |||
Rem Audio Example | |||
Function PlayButton_onclick() | Function PlayButton_onclick() | ||
Audio1.play | Audio1.play() | ||
End Function | End Function | ||
</ | </syntaxhighlight> | ||
</tabber> | |||
== Output == | |||
<pre> | <pre> | ||
Line 46: | Line 59: | ||
</pre> | </pre> | ||
[[Category:Language Reference]] | |||
[[Category:Controls]] | |||
[[ | [[Category:General]] |
The Audio control is used to play a sound. The sound can be any common format, including mp3, ogg, uncompressed wav and aac. Not all formats will play back on an app which is saved to the Home screen.
To add a sound to your app, choose the Audio icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need. Depending on the options you choose, the control may be invisible.
Here's a excellent article on what can and cannot be done with iOS Audio: http://www.ibm.com/developerworks/library/wa-ioshtml5/
Standard properties are supported, plus:
autoplay | Audio will start playing as soon as ready. Not supported on iOS. |
controls | Controls will be displayed, such as a Play. |
loop | Audio will start over again when finished. |
preload | Audio should be loaded when the page loads. Ignored if autoplay is present. |
src | The name of the file. For example, Super.wav. It should be in the project folder. |
pause() | Pause playing the sound |
play() | Start playing the sound |
//Audio Example
PlayButton.onclick = function() {
Audio1.play();
}
Rem Audio Example
Function PlayButton_onclick()
Audio1.play()
End Function
(sound plays)