Re: ANDROID player won't play MP3 from server but locally?
Hi Jacque, wonderful, thank you very much! Will test this and report back. > Am 23.10.2023 um 21:45 schrieb J. Landman Gay via use-livecode > : > > On 10/22/23 7:34 AM, Klaus major-k via use-livecode wrote: >> I'm having problems to play a MP3 (5 MB) from my server. And yes, I waited >> up to a minute before I closed the app. Works fine when I play it locally. > > > Below is the script I use for mobile players. It's old so things may be > different now, but if I remember right I had to check playerPropertyAvailable > for the duration to be sure the player had enough content to start playing. > > on createMobileAudioPlayer pURL, pPlayerName > -- pURL = remote video or audio file > -- pPlayerName = name of player to create; if empty uses LC-assigned ID > if sPlayerID is in mobileControls() then mobileControlDelete sPlayerID -- > init > if pPlayerName = "" then >mobileControlCreate "player" >put the result into sPlayerId > else >mobileControlCreate "player",pPlayerName >put pPlayerName into sPlayerID > end if > mobileControlSet sPlayerId, "rect", getPlayerRect() -- can use a literal > rect instead > mobileControlSet sPlayerId, "showController", true > mobileControlSet sPlayerId, "filename", pURL > mobileControlSet sPlayerId, "visible", true > if pURL begins with "http" then >mobileBusyIndicatorStart "square", "Loading..." -- add loading indicator > until duration is available > end if > end createMobileAudioPlayer > > on playerPropertyAvailable pProperty -- msg sent when enough content is loaded > if pProperty is "duration" then >mobileBusyIndicatorStop -- Remove the "Loading..." indicator and start > playing >mobileControlDo sPlayerId, "play" > end if > end playerPropertyAvailable > > on setMobileAudioPlayer pPlayerName,pState -- control the state of the mobile > player > -- pState = "pause", "play", or "stop" > if pPlayerName is not among the lines of mobileControls() then exit > setMobileAudioPlayer > mobileControlDo pPlayerName, pState > if pState = "stop" then >mobileBusyIndicatorStop -- in case it's still showing >mobileControlSet pPlayerName, "visible", false >mobileControlDelete pPlayerName > end if > end setMobileAudioPlayer > > on playerFinished -- sent on mobile when audio is done > setMobileAudioPlayer "stop" > end playerFinished > > -- > Jacqueline Landman Gay | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com Best Klaus -- Klaus Major https://www.major-k.de https://www.major-k.de/bass kl...@major-k.de ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: ANDROID player won't play MP3 from server but locally?
On 10/22/23 7:34 AM, Klaus major-k via use-livecode wrote: I'm having problems to play a MP3 (5 MB) from my server. And yes, I waited up to a minute before I closed the app. Works fine when I play it locally. Below is the script I use for mobile players. It's old so things may be different now, but if I remember right I had to check playerPropertyAvailable for the duration to be sure the player had enough content to start playing. on createMobileAudioPlayer pURL, pPlayerName -- pURL = remote video or audio file -- pPlayerName = name of player to create; if empty uses LC-assigned ID if sPlayerID is in mobileControls() then mobileControlDelete sPlayerID -- init if pPlayerName = "" then mobileControlCreate "player" put the result into sPlayerId else mobileControlCreate "player",pPlayerName put pPlayerName into sPlayerID end if mobileControlSet sPlayerId, "rect", getPlayerRect() -- can use a literal rect instead mobileControlSet sPlayerId, "showController", true mobileControlSet sPlayerId, "filename", pURL mobileControlSet sPlayerId, "visible", true if pURL begins with "http" then mobileBusyIndicatorStart "square", "Loading..." -- add loading indicator until duration is available end if end createMobileAudioPlayer on playerPropertyAvailable pProperty -- msg sent when enough content is loaded if pProperty is "duration" then mobileBusyIndicatorStop -- Remove the "Loading..." indicator and start playing mobileControlDo sPlayerId, "play" end if end playerPropertyAvailable on setMobileAudioPlayer pPlayerName,pState -- control the state of the mobile player -- pState = "pause", "play", or "stop" if pPlayerName is not among the lines of mobileControls() then exit setMobileAudioPlayer mobileControlDo pPlayerName, pState if pState = "stop" then mobileBusyIndicatorStop -- in case it's still showing mobileControlSet pPlayerName, "visible", false mobileControlDelete pPlayerName end if end setMobileAudioPlayer on playerFinished -- sent on mobile when audio is done setMobileAudioPlayer "stop" end playerFinished -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
ANDROID player won't play MP3 from server but locally? 2
Hi friends, OK, found at least the DELETE problem... 8-) command delete_player mobileControlDo "mplayer", "stop" ## mobileControlDelete "player", "mplayer" ## has to be: mobileControlDelete "mplayer" end delete_player Best Klaus -- Klaus Major https://www.major-k.de https://www.major-k.de/bass kl...@major-k.de ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
ANDROID player won't play MP3 from server but locally?
Hi friends, I'm having problems to play a MP3 (5 MB) from my server. And yes, I waited up to a minute before I closed the app. Works fine when I play it locally. The device is connected via (not slow) W-Lan to the internet. LC 9.6.10, macOS 12.7, Android 8.01 I created two buttons for create and delete and put this into the card script - command create_player ## This creates a black rect and nothing more?! ## I don't even see the ANSWER at the end of the script put "https://www.major-k.de/blueprint.mp3; into tURL ## Works immediately when using Safari browser on my Mac, ## so the file is definitively there and URL correct! ## And yes, I added SSL & Encryption neccessary for -> httpS ## This works as advertised ## put specialfolderpath("resources") & "/blueprint.mp3" into tURL mobilecontrolCreate "player", "mplayer" mobileControlSet "mplayer", "visible", TRUE ## That grc is hidden: mobileControlSet "mplayer", "rect", (the rect of grc "player") mobileControlSet "mplayer", "backgroundcolor", "213,143,116" mobileControlSet "mplayer", "showController", TRUE mobileControlSet "mplayer", "filename", tURL if mobileControlGet("mplayer", "duration") = 0 then answer "Player is not initialised correctly" end if mobileControlDo "mplayer", "play" end create_player command delete_player mobileControlDo "mplayer", "stop" mobileControlDelete "player", "mplayer" end delete_player Most of the time I have to tap the "delete" button at least 5 times or more before the player finally disappears? However the sound stops immediately at the first tap!? What am I missing? Thanks for any hint! Best Klaus -- Klaus Major https://www.major-k.de https://www.major-k.de/bass kl...@major-k.de ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode