mobileControlSet not working with variable ?

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

mobileControlSet not working with variable ?

Post by sphere » Tue Dec 13, 2016 10:16 pm

Hello,

i have a few questions about mobileControlCreate and mobileControlSet on Android Emulator
and not yet tested on real device

This piece is just to set some things

Code: Select all

mobileControlCreate "player", "mobmusicplayer"
 put the result into gMobMusicPlayer
mobileControlSet gMobMusicPlayer, "showController", true
mobileControlSet gMobMusicPlayer, "visible", true

The next line seems to have no influence at all

Code: Select all

mobileControlSet gMobMusicPlayer, "rect","0,169,300,33"
The next line seems to have no influence at all

Code: Select all

mobileControlSet gMobMusicPlayer, "backgroundColor", "Red"
The next line seems to have no influence at all

Code: Select all

mobileControlSet gMobMusicPlayer, "textColor", "White"
I tried to use libURLDownloadToFile to download a mp3 file to the stack, but this seems to do nothing at all.
Sort of streaming seems to work:

This is working ok on the emulator: (luckely i do not have to copy all mp3's into the stack)

Code: Select all

mobileControlSet gMobMusicPlayer, "filename", "https://site.nl/album/yoohoow.mp3"
mobileControlDo gMobMusicPlayer, "play"
and the mp3 starts playing nicely

But it seems not to work with this:

Code: Select all

put "https://site.nl/album/yoohoow.mp3" into tThisTrack
mobileControlSet gMobMusicPlayer, "filename", tThisTrack
mobileControlDo gMobMusicPlayer, "play"
Also not with this:

Code: Select all

put quote & "https://site.nl/album/yoohoow.mp3" & quote into tThisTrack
mobileControlSet gMobMusicPlayer, "filename", tThisTrack
mobileControlDo gMobMusicPlayer, "play"
why is this not working with a variable?
I would like it to be a variable to be more flexible.
is it a bug?

Thanks for any help on this.
Sphere

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: mobileControlSet not working with variable ?

Post by LiveCode_Panos » Wed Dec 14, 2016 3:16 pm

Hi Sphere,

The mobileControlSet command does work with variables. Just make sure that the variables have the correct scope. For example, you say that:
The next line seems to have no influence at all

Code: Select all

mobileControlSet gMobMusicPlayer, "rect","0,169,300,33"
Where have you put this command? Is it in the same handler where the mobile player is created? I suggest you either post the full code here (or the stack itself), or file a bug report and attach a simple sample stack that demonstrates the problem.

Moreover, this is not correct:

Code: Select all

mobileControlCreate "player", "mobmusicplayer"
put the result into gMobMusicPlayer
Best,
Panos
--

You can do either:

Code: Select all

mobileControlCreate "player", "gMobMusicPlayer"
OR

Code: Select all

mobileControlCreate "player"
put the result into gMobMusicPlayer

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: mobileControlSet not working with variable ?

Post by sphere » Wed Dec 14, 2016 8:38 pm

Hi Panos,

then i guess i made a mistake, i took it from an example.
So this is not correct, although it looked legit to me...compared to the example in the dictionary, but maybe i though'd wrong

Code: Select all

mobileControlCreate "player", "mobmusicplayer"
put the result into gMobMusicPlayer
And this is then ok

Code: Select all

mobileControlCreate "player"
put the result into gMobMusicPlayer
In the Cardscript i have this (among a bunch of other stuff

Code: Select all

global gMobMusicPlayer
on mouseUp
if the environment is "mobile" then
 mobileControlCreate "player" # this should be it
 put the result into gMobMusicPlayer
  mobileControlSet gMobMusicPlayer, "showController", true
mobileControlSet gMobMusicPlayer, "visible", true
mobileControlSet gMobMusicPlayer, "rect","0,169,300,33"
mobileControlSet gMobMusicPlayer, "backgroundColor", "Red" #just took some colors to see if it works
mobileControlSet gMobMusicPlayer, "textColor", "White"
end if
end mouseUp
then in an imagescript i have (there are multiple little images) representing the cover of a track:
when an album via the mobilepick command is chosen the app fetches the images from the server and puts it in the images on the card
when an image is touched then the music should play
i need to use variable so that i can add new music/album and this is fetched into a new list (this already works)
only the variable seems not to work with the player and the colors but that's less important

Code: Select all

global gAlbumName,gMobMusicPlayer,gTrackName
on mouseUp
if the environment is "mobile" then
   mobileControlDo gMobMusicPlayer, "stop" #should stop playing if it is playing, because now we want to hear a new track
mobileControlSet gMobMusicPlayer, "filename", "https://site.nl/album/yoohoow.mp3" #this works
#mobileControlSet gMobMusicPlayer, "filename", "https://site.nl" & slash & gAlbumName & slash & gTrackName #this is what i need
mobileControlDo gMobMusicPlayer, "play"
end mouseUp
i will test without that second part after the mobilecontrolcreate
i'll let you know

Thanks for your help

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: mobileControlSet not working with variable ?

Post by sphere » Wed Dec 14, 2016 10:36 pm

Hi Panos,

ok that last part did not help either.
I now changed it and putted all the mobilecreate stuff in a separate handler in the card script.

If that also does not work with a variable then i will file a bug report and send you the stack.

Thanks!

Best regards,
Sphere

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: mobileControlSet not working with variable ?

Post by sphere » Thu Dec 15, 2016 1:16 pm


LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: mobileControlSet not working with variable ?

Post by LiveCode_Panos » Thu Dec 15, 2016 5:27 pm

Thanks sphere,

I have posted a comment to the bug report.

Best regards,
Panos
--

Post Reply

Return to “Android Deployment”