Page 1 of 1
Stop or play don't work on mplayer
Posted: Fri Feb 24, 2012 1:00 am
by JosepM
Hi,
I need help. I just try to create a player to listen online radios from a .pls file from a server. Only I need play and stop.
The app start playing the radio fine without problem, but when I try to stop or play again nothing happen.
I have two buttons that call "PauseRadio" and "PlayRadio".
Also if I try to trap the message that appear into the iOS documentation nothing happen...
What I'm missing?
I have this code:
Code: Select all
sPlayerID
on opencard
if the environment is "mobile" then
iphoneControlCreate "player"
put the result into sPlayerID
iphoneControlSet sPlayerID, "fileName", "http://www.rac1.org/audio/Player/nou_listen.pls"
iPhoneControlSet sPlayerID, "shouldAutoplay", "true"
iphoneControlDo sPlayerID, "prepareToPlay"
iphoneControlDo sPlayerID, "play"
end if
end opencard
on closeCard
if the environment is "mobile" then
iphoneControlDelete sPlayerID
end if
end closeCard
on PlayRadio
iphoneControlDo sPlayerID, "play"
end PlayRadio
on StopRadio
iphoneControlDo sPlayerID, "stop"
end StopRadio
Re: Stop or play don't work on mplayer
Posted: Fri Feb 24, 2012 1:44 am
by Dixie
Hi Joseph..
I just tried your code on an iphone... it works without any problems.... the only alteration that I made to your code is that I declared your variable by placing 'local' in front of 'sPlayerID' on the first line...
I've attached the stack...
be well
Dixie
Re: Stop or play don't work on mplayer
Posted: Fri Feb 24, 2012 8:30 am
by JosepM
Hi Dixie,
Yes, with the Local work fine...
Salut,
Josep
Re: Stop or play don't work on mplayer
Posted: Fri Feb 24, 2012 4:55 pm
by JosepM
Hi,
Now I have other issue with the audio. I want that when the app start, begin to play the radio streaming, this is ok, but when I go to other card the music stop. I these card I use a browser object to load the Facebook fan page of the radio and in other card I want to use other browser to show the youtube channel.
Why the music streaming stop? I move the script to a stack level but happen the same.
Maybe I can use groups and show and hide them, but the browser don't work into a group.
Thoughts?
Salut,
Josep M
Re: Stop or play don't work on mplayer
Posted: Fri Feb 24, 2012 7:34 pm
by Dixie
Joseph...
The music stops playing because you are 'destroying' the control when closing the card..
Code: Select all
on closeCard
if the environment is "mobile" then
iphoneControlDelete sPlayerID
end if
end closeCard
if you make the 'player' invisible when you create it, you can then move to another card and back again and the music will continue to play. See the changes to creating the player in the openCard handler... and notice that I have commented out the 'iphoneControlDelete' command in the closeCard handler.
Code: Select all
local sPlayerID
on opencard
if the environment is "mobile" then
if sPlayerID is empty then
iphoneControlCreate "player"
put the result into sPlayerID
iphoneControlSet sPlayerID, "fileName", "http://www.rac1.org/audio/Player/nou_listen.pls"
iPhoneControlSet sPlayerID, "shouldAutoplay", "true"
iphoneControlDo sPlayerID, "prepareToPlay"
iphoneControlSet sPlayerID, "visible", "false"
iphoneControlDo sPlayerID, "play"
end if
end if
end opencard
on closeCard
if the environment is "mobile" then
--iphoneControlDelete sPlayerID
end if
end closeCard
on PlayRadio
iphoneControlDo sPlayerID, "play"
end PlayRadio
on StopRadio
iphoneControlDo sPlayerID, "stop"
end StopRadio
and, the browser does work within a group...
be well
Dixie
Re: Stop or play don't work on mplayer
Posted: Fri Feb 24, 2012 7:42 pm
by JosepM
Oppsss...
Thanks!
Josep M
Re: Stop or play don't work on mplayer
Posted: Fri Feb 24, 2012 7:50 pm
by Dixie
Joseph...
I have just reread my post... the idea behind making the player invisible, since it's music you don't need to see it, is when you go to another card it won't clash with another native control that you might wish to use of the next card that you are going to... like the 'browser' control you mentioned...
be well
Dixie
Re: Stop or play don't work on mplayer
Posted: Fri Feb 24, 2012 8:57 pm
by JosepM
Hi,
Yes, so I need only one 'player' control, and I can have one 'browser' control on each card, right? Should be work, isn't?
Maybe better that deal with groups.
Salut,
Josep M
Re: Stop or play don't work on mplayer
Posted: Tue Apr 30, 2013 12:04 pm
by archer2009BUSknbj
Dixie wrote:Hi Joseph..
I just tried your code on an iphone... it works without any problems.... the only alteration that I made to your code is that I declared your variable by placing 'local' in front of 'sPlayerID' on the first line...
I've attached the stack...
be well
Dixie
I tried to save the attached LiveCode file as a standalone Android App APK File - but a message comes up saying
not supported on this platform
Is there a way to may a basic player like this work on both Android and iPhone with a single CodeBase or do we need to detect which device is being used and use something different for each platform?
Re: Stop or play don't work on mplayer
Posted: Tue Apr 30, 2013 12:24 pm
by Dixie
Wherever in the script it has 'iphoneControl...', change the syntax to 'mobileControl...' ... that should make it work ! I can't see any other iphone specific things in the scripts, looking over it quickly...
Dixie