media player doesn't work??

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
theshermanator
Posts: 11
Joined: Thu Apr 25, 2013 3:55 am

media player doesn't work??

Post by theshermanator » Thu Apr 25, 2013 4:01 am

Does the media player not work with android devices?
I dragged the media player onto my stack, then was able to add a URL to the file which was a remote MP3. Worked.
I also added a streaming .PLU url from a streaming internet radio station. Worked great.

I createed a mac osx standalone and it worked great.

But when I save as an android app the media object shows up as a blue ugly bar and sits there and does nothing. It won't play.
Is there a special setting for this on android?

I am trying to play an MP3 URL or a PLS url

:?: :?:

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: media player doesn't work??

Post by Simon » Thu Apr 25, 2013 4:17 am

Hi theshermanator,
Welcome to the forum!
Please do not double post your questions as no one will know which to follow.

Android does not use the media player, look up AndroidPlayer in the dictionary and mobileControlCreate in the Android user notes. You will have to scroll down a few pages to see the Player controls in the notes.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

theshermanator
Posts: 11
Joined: Thu Apr 25, 2013 3:55 am

Re: media player doesn't work??

Post by theshermanator » Thu Apr 25, 2013 4:20 am

Thanks , sorry about that.
I did try mobileControlCreate however I got a handler not found error .. Do I have to install an additional plugin for this?

theshermanator
Posts: 11
Joined: Thu Apr 25, 2013 3:55 am

Re: media player doesn't work??

Post by theshermanator » Thu Apr 25, 2013 4:29 am

Nevermind my last post

This is what i'm doing:

mobileControlCreate "player", "movie"
put the result into sPlayerID
mobileControlSet sPlayerID, "h t t p : / / u r l t o s e r v e r : 8 0 3 0 /listen.pls", tMoviePath
play sPlayerID


Does this look right?
I'm not getting any errors
But I'm not getting any audio ...

theshermanator
Posts: 11
Joined: Thu Apr 25, 2013 3:55 am

Re: media player doesn't work??

Post by theshermanator » Thu Apr 25, 2013 4:36 am

actually i'm also getting this error when trying to run the code:

(Handler: can't find handler) near "mobileControlCreate", char 1

:?: :|

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: media player doesn't work??

Post by Simon » Thu Apr 25, 2013 4:42 am

Android does not support .pls:
http://developer.android.com/guide/appe ... rmats.html

(Handler: can't find handler) near "mobileControlCreate", char 1
Only shows up in the IDE as it is a mobile command (not for desktop).
You should have
if the environment is "mobile" then
mobileControlCreate "player"
etc.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

theshermanator
Posts: 11
Joined: Thu Apr 25, 2013 3:55 am

Re: media player doesn't work??

Post by theshermanator » Thu Apr 25, 2013 5:00 am

I added that in my script:

if enviornment is "mobile" then
mobileControlCreate "player", "movie"
put the result into sPlayerID
mobileControlSet sPlayerID, "h t t p : // w w w . u n i v e r s a l - s o u n d b a n k . c o m /mp3/sounds/22415.mp3", tMoviePath
end if

However nothing plays when I test the app on android

:?: :?:

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: media player doesn't work??

Post by Simon » Thu Apr 25, 2013 5:13 am

You have some oddities in there. Look here it's already been discussed:
http://forums.runrev.com/phpBB2/viewtop ... yer#p63321

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

theshermanator
Posts: 11
Joined: Thu Apr 25, 2013 3:55 am

Re: media player doesn't work??

Post by theshermanator » Thu Apr 25, 2013 6:00 am

Thank Simon I tried your example but it will didn't play .... Does this support an mp3 URL verses local file ???

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: media player doesn't work??

Post by Simon » Thu Apr 25, 2013 6:09 am

Try the local first just to see if you can play it (you have to know the path to it).
I know locals work.
Then try the URL, tell me if it works.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

theshermanator
Posts: 11
Joined: Thu Apr 25, 2013 3:55 am

Re: media player doesn't work??

Post by theshermanator » Thu Apr 25, 2013 7:49 am

When trying to play a mp3 url I can a playback of a static sound .. which sounds like perhaps it's not supporting the audio compression type? Perhaps converting the mp3 url to mp4 would work? ..

I tried to play a local file without any success
..

:|

theshermanator
Posts: 11
Joined: Thu Apr 25, 2013 3:55 am

Re: media player doesn't work??

Post by theshermanator » Thu Apr 25, 2013 8:20 am

Okay I figured out that it's a compression issue.
Could not play a .mp3 url... However I was SUCCESSFUL at playing an audio file compressed as M4A.
likely could just be due to bitrate or sample rate on the actual file regardless of it's compression. I'm sure there is a way to get around streaming .PLS from an internet radio audio stream .. I'll continue to post my results ..

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: media player doesn't work??

Post by Simon » Thu Apr 25, 2013 8:24 am

Great work!
Keep posting your findings.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

theshermanator
Posts: 11
Joined: Thu Apr 25, 2013 3:55 am

Re: media player doesn't work??

Post by theshermanator » Thu Apr 25, 2013 8:52 am

Fixed!

I found out that you can play .MP3 and any other audio compression via URL but your audio compression must be:

Bit rate: 128 kbps rate
Sample rate: 44.100 HZ sample rate

This is the same for streaming audio such as internet radio

I was successful when playing streaming audio from internet radio. By linking directly to the source feed verses the .PLS file (which probably just confuses the stack as it's looking for audio data not a config file)
For example:
this works: h t t p : / / 6 4 . 7 1 . 1 5 8 . 1 7 2 :8030/
this does not work:h t t p : / / 6 4 . 7 1 . 1 5 8 . 1 7 2 : 8030/listen.pls

:D 8) :wink:

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”