Looks like you need to add a few more properties. This works for me on Android:
Code: Select all
if the environment = "mobile" then
## Create a native player:
mobilecontrolcreate "player", "playSing"
## set more properies here...
mobilecontrolset "playSing","rect","10,10,200,50" -- adjust this to fit your app layout
mobilecontrolset "playSing","visible",true
mobilecontrolset "playSing","showController",true
## Set filename or URL for this player:
mobilecontrolset "playSing","filename",_playMusic
## Finally start that thing:
mobileControlDo "playSing", "play"
else
set the filename of player "sing" of cd "setting"to _playMusic
start player "sing" of cd "setting"
end if
You can set the visible and showController to false if you don't want to see it. It appears that at least a rect is required. The default is to show the controller and the player. If you don't want the player to show, the actual rect isn't very important.
Also, make sure you have ticked the Internet checkbox in Android standalone settings. Also be sure you have Internet and (if available) TSNet selected in standalone inclusions.
When you're done with it, use mobileControlDelete to remove it from memory. That's required, since scripted mobile controls never go away until you quit the app or specifically remove them, and can interfere with other cards or controls.
I like the music.
Edit: You can delete the widget since you aren't using it. Also, the final "if" clause at the end of your handler is missing an "end if" and it has two "then"s. And typically there's a space between "url" and the url itself, though apparently the way you have it doesn't error. I do this: