Plays a sound file stored remotely or on the local filesystem.
See Also: CreateMediaPlayer
Example - Play Local Sound File
function OnStart(){
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
btn = app.CreateButton( "Press Me", 0.3, 0.1 );
btn.SetOnTouch( btn_OnTouch );
lay.AddChild( btn );
app.AddLayout( lay );
}
function btn_OnTouch()
{
app.PlaySound( "/Sys/Snd/Trill.ogg" );
}
Example - Play Remote Sound File
function OnStart(){
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
btn = app.CreateButton( "Press Me", 0.3, 0.1 );
btn.SetOnTouch( btn_OnTouch );
lay.AddChild( btn );
app.AddLayout( lay );
}
function btn_OnTouch()
{
app.PlaySound( "https://sgarman.net/silly.mp3" );
}