How to play music from a URL on Android?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to play music from a URL on Android?
How to play music from a URL on Android?
-
- VIP Livecode Opensource Backer
- Posts: 7233
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to play music from a URL on Android?
Use a player control and set its URL property. The music must be in a format that Android supports, mp3 is common.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: How to play music from a URL on Android?
Isn't the "player object" desktop only?
-
- VIP Livecode Opensource Backer
- Posts: 7233
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to play music from a URL on Android?
Oh, right. Sorry. Android needs the scripted player using mobileControlCreate.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: How to play music from a URL on Android?
Ah, yes, true, there you can also set the URL for the created player.
Re: How to play music from a URL on Android?
So how do I do that?
Re: How to play music from a URL on Android?
Check "mobilecontrolcreate", "mobilecontroldo" and "mobilecontrolset" in the dictionary.
There are some example on how to use these commands.
And don't forget, they will only work on MOBILE and throw an error on desktop, so use:
There are some example on how to use these commands.
And don't forget, they will only work on MOBILE and throw an error on desktop, so use:
Code: Select all
...
if the environment = "mobile" then
## Create a native player:
mobilecontrolcreate "player", "name for your player"
## set more properies here...
## Set filename or URL for this player:
mobilecontrolset "name for your player","filename","https://complete URL here..."
## Finally start that thing:
mobileControlDo "name for your player", "play"
end if
...
Re: How to play music from a URL on Android?
What do I put in "filename"?
Re: How to play music from a URL on Android?
Nothing!
This is the name of the property which has to be put in QUOTES with "mobilecontrolset".
I may repeat myself:
So please DO!Check "mobilecontrolcreate", "mobilecontroldo" and "mobilecontrolset" in the dictionary.
There are some example on how to use these commands.
Re: How to play music from a URL on Android?
This is the code I put:
But it still does not work
Of course in the variable _playMusic I put the URL
Code: Select all
if the environment = "mobile" then
## Create a native player:
mobilecontrolcreate "player", "playSing"
## set more properties here ...
## Set filename or URL for this player:
mobilecontrolset "playSing", "playSing", _playMusic
## Finally start that thing:
mobileControlDo "playSing", "play"
else
set the filename of player "sing" or cd "setting" to _playMusic
start player "sing" of cd "setting"
end if
Of course in the variable _playMusic I put the URL
Last edited by liveCode on Wed Apr 06, 2022 1:31 pm, edited 2 times in total.
Re: How to play music from a URL on Android?
There is a SPACE between _ and play in the script:
_ playMusic
_ playMusic
Re: How to play music from a URL on Android?
There is no space in my code
I accidentally added it when I posted
I accidentally added it when I posted
Re: How to play music from a URL on Android?
OK, but this cannot work:
Guess why!
Hint: FILENAME
And change this:
Code: Select all
...
## Set filename or URL for this player:
mobilecontrolset "playSing", "playSing", _playMusic
...
Hint: FILENAME
And change this:
Code: Select all
...
## start player "sing" or cd "setting"
## to
start player "sing" OF cd "setting"
...
Re: How to play music from a URL on Android?
I changed back to filename and it still did not workKlaus wrote: ↑Wed Apr 06, 2022 1:25 pmOK, but this cannot work:Guess why!Code: Select all
... ## Set filename or URL for this player: mobilecontrolset "playSing", "playSing", _playMusic ...
Hint: FILENAME