Page 1 of 1

play audiofile from web server

Posted: Mon Mar 26, 2018 5:28 pm
by per_bodelius
Hi there,
Can anybody tell me how I can play an audiofile from an url on iphone and android. If I test the following,
play "<domain-name>/.../sound/math002.aiff", it works well when I try it on PC and Mac.I can´t find anything about this in the LIveCode documentation.

Re: play audiofile from web server

Posted: Tue Mar 27, 2018 3:12 pm
by MaxV
I think that on mobile you have to use or the browser or the player object.

Re: play audiofile from web server

Posted: Tue Mar 27, 2018 4:00 pm
by Klaus
"player" objects are desktop-only and not available on the mobile platform!

On mobile you need to use "mobilecontrolcreate" to create a mobile native "player" control.
Then you can use "mobilecontrolset" to set its filename to the url on your server.

Re: play audiofile from web server

Posted: Thu Mar 29, 2018 11:10 am
by Klaus
I moved this thread over to the beginners section, since it is really not OFF-TOPIC.

Re: play audiofile from web server

Posted: Mon Apr 02, 2018 12:34 pm
by per_bodelius
Hi Klaus,
I have tested to do as you said; "using mobileControlSet" , but I cannot get it working.,,
This is the code I have used:

on MouseDown
put "h t t p://www.<my domain.s e>/matteapp/sound/math002.mp3" into sLink
mobilecontrolCreate "player","mplayer"
mobileControlSet "mplayer","filename",sLink
mobileControlDo "mplayer", "play"
end MouseDown

Am I doing anything wrong with the code? I have also tested with different types of sound file (wav,mp3,aiff) and with different bitrate for mp3.

Re: play audiofile from web server

Posted: Mon Apr 02, 2018 5:36 pm
by Klaus
Hi Per,

I don't own a mobile device nor do I develop for mobile, but maybe you also need to set the rect and visible property? At least worth a try...

Code: Select all

on MouseDown
put "h t t p://www.<my domain.s e>/matteapp/sound/math002.mp3" into sLink
  mobilecontrolCreate "player","mplayer"
  mobileControlSet "mplayer","rect","0,0,100,20"
  mobileControlSet "mplayer","visible",TRUE

  ## And maybe:
  mobileControlSet "mplayer","showcontroller",TRUE
  mobileControlSet "mplayer","filename",sLink
  mobileControlDo "mplayer", "play"
end MouseDown
Best

Klaus

Re: play audiofile from web server

Posted: Tue Apr 03, 2018 12:13 am
by per_bodelius
Hi again Klaus!
Thanks for your time an engagement in this task, but unfortunately it didn't help...same result.
Maybe some other "Livecoder" has succeeded in using "mobilecontrolcreate" for playing audio on IOS devices.
I use LC Indy 8.1.9 (rc1) + Xcode 9.2 + MacOS 10.13.3

Re: play audiofile from web server

Posted: Fri Apr 20, 2018 8:41 pm
by PaulDaMacMan
Klaus wrote:
Tue Mar 27, 2018 4:00 pm
"player" objects are desktop-only and not available on the mobile platform!

On mobile you need to use "mobilecontrolcreate" to create a mobile native "player" control.
Then you can use "mobilecontrolset" to set its filename to the url on your server.
I'm not sure that is the case, at least not with sound files on Android.
I've used:

Code: Select all

play theFile
on Android for a while now to play MIDI files generated with LiveCode. I would think it works with any media filetype supported by the OS but I haven't tested it with .aif files.