Audio: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
JwellsNB (talk | contribs)
No edit summary
Line 31: Line 31:
|}
|}


== Example ==
== Example (Basic) ==


<pre>
<pre>
Line 38: Line 38:
   Audio1.play()
   Audio1.play()
End Function
End Function
</pre>
== Example (JavaScript) ==
<pre>
//Audio Example
PlayButton.onclick = function() {
  savethefunction_rvar="";
  Audio1.play();
  return savethefunction_rvar;
}
</pre>
</pre>



Revision as of 04:21, 1 May 2013

Description

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 format 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.

Properties

Standard properties are supported, plus:

autoplay Audio will start playing as soon as ready.
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.

Methods

pause() Pause playing the sound
play() Start playing the sound

Example (Basic)

Rem Audio Example
Function PlayButton_onclick()
  Audio1.play()
End Function

Example (JavaScript)

//Audio Example

PlayButton.onclick = function() {
  savethefunction_rvar="";
  Audio1.play();
  return savethefunction_rvar;
}

Output

(sound plays)