ANDROID player won't play MP3 from server but locally?
Klaus major-k
klaus at major-k.de
Mon Oct 23 15:52:25 EDT 2023
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 <use-livecode at lists.runrev.com>:
>
> 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 | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
Best
Klaus
--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
klaus at major-k.de
More information about the use-livecode
mailing list