the media player not working on android??
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 11
- Joined: Thu Apr 25, 2013 3:55 am
the media player not working on android??
Does the media player not work with android devices?
I successfully added a streaming audio .PLS url to the media device which works find when I create a mac osx standalone or when I test in the livecode stack.
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
I successfully added a streaming audio .PLS url to the media device which works find when I create a mac osx standalone or when I test in the livecode stack.
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
-
- Site Admin
- Posts: 343
- Joined: Thu Feb 23, 2006 7:59 pm
- Location: Wales
Re: the media player not working on android??
You need to create a native Android player using the mobileControlCreate command. The player object in the IDE is for desktop only.
I hope this helps,
Regards,
Heather
Customer Services Manager
RunRev Ltd
I hope this helps,
Regards,
Heather
Customer Services Manager
RunRev Ltd
-
- Posts: 11
- Joined: Thu Apr 25, 2013 3:55 am
Re: the media player not working on android??
I've fixed the issue with both local and MP3 urls and streaming audio from internet radio stations. All now successfully play on an android device.
Please see, http://forums.runrev.com/viewtopic.php?f=7&t=14911
Please see, http://forums.runrev.com/viewtopic.php?f=7&t=14911
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: the media player not working on android??
Heather,heatherlaine wrote:You need to create a native Android player using the mobileControlCreate command. The player object in the IDE is for desktop only.
I hope this helps,
Regards,
Heather
Customer Services Manager
RunRev Ltd
So the command must be called while the app is running in the Android environment? I suppose the preOpenStack handler would be the place to create all the necessary controls if I have a one card app. I'll give an example of a stack I developed for OSX and Windows in which I imported audio (AIF) clips and played them using the "play" command. In Android, however, I'd need to use:
Code: Select all
mobileControlCreate "player" , "myPlayer1"
Code: Select all
mobileControlDo "myPlayer1", "play"
Thanks,
Barry
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: the media player not working on android??
Okay; I think I'm getting a bit closer.
...creates the player.
...sets the player invisible.
...sets the path to the clip???
...so to play the clip I would then use
Am I correct? If so, how do I determine what the pathname is of my audio clip assuming I've imported it into the stack in the IDE on OSX?
Thanks,
Barry
Code: Select all
mobileControlCreate "player" , "myPlayer1"
Code: Select all
mobileControlSet "myPlayer1" , "visible" , false
Code: Select all
mobileControlSet "myPlayer1" , "filename" , PATHNAME-TO-AUDIO
...so to play the clip I would then use
Code: Select all
mobileControDo "myPlayer1" , "play"
Thanks,
Barry
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: the media player not working on android??
I'm still groping around in the dark. I've attached inline a screenshot showing an audio file I've added using the "Copy Folder" facility in the Standalone Application Settings dialog. Apparently it used the containing folder ("LivecodeAndroidTest") as well as the folder I created called "Audio".
(By the way, I was able to examine this by duplicating the .apk file, changing its extension to .zip and then unzipping the file to reveal the contents.)
So some questions come to mind:
1. May I move the Audio folder up a level (into "assets") and then delete the "LivecodeAndroidtest" folder? I'd then re-zip the folder and rename it with the proper .apk extension.
2. What would be the pathname of my audio clip which, presumably,
...would play. (Am I correct there?)
Thanks,
Barry
(By the way, I was able to examine this by duplicating the .apk file, changing its extension to .zip and then unzipping the file to reveal the contents.)
So some questions come to mind:
1. May I move the Audio folder up a level (into "assets") and then delete the "LivecodeAndroidtest" folder? I'd then re-zip the folder and rename it with the proper .apk extension.
2. What would be the pathname of my audio clip which, presumably,
Code: Select all
mobileControlDo "play" , PATHNAME
Thanks,
Barry
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: the media player not working on android??
Hi Barry,
On mobile content copied using the Copy Files in standalone settings end up in
specialFolderPath ("engine")
So if you copied a folder named Assets that contained myBest.mp3 then the path is
specialFolderPath ("engine") & "/Assets/myBest.mp3"
There was recently a lot of trouble with copying a folder (6.5 may have it fixed but I haven't tested it yet) so you should start with just copying the file itself (e.g. myBest.mp3) and not the whole folder.
Simon
On mobile content copied using the Copy Files in standalone settings end up in
specialFolderPath ("engine")
So if you copied a folder named Assets that contained myBest.mp3 then the path is
specialFolderPath ("engine") & "/Assets/myBest.mp3"
There was recently a lot of trouble with copying a folder (6.5 may have it fixed but I haven't tested it yet) so you should start with just copying the file itself (e.g. myBest.mp3) and not the whole folder.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: the media player not working on android??
Simon,
Thanks for your reply. I think I'm not quite understanding things (or there's a bug). I'm using Community Edition 7.0 (stable). I have a button on the stack with this code in it:
I examined the .apk file by duplicating it in the Finder, changing it's extension to .zip, and then unzipping it where I could see the exact path to the audio file (which I've used for my script).
When I install the .apk in my Nexus 5 and launch the app, I tap on the button and see the screen flash black momentarily. (I think this is a bug someone else reported and maybe if I alter my script I can prevent that flash. However, no audio file plays. I'm at a loss to understand what I'm doing wrong here.
Thanks,
Barry
Thanks for your reply. I think I'm not quite understanding things (or there's a bug). I'm using Community Edition 7.0 (stable). I have a button on the stack with this code in it:
Code: Select all
on mouseUp
mobileControlCreate "player" , "player1"
mobileControlSet "player1" , "visible" , false
mobileControlSet "player1" , "rect" , "0,0,0,0"
mobileControlSet "player1" , "filename" , specialFolderPath(engine) & "assets/LivecodeAndroidtest/Audio/Click(96kb).mp3"
mobilControlDo "player1" , "play"
end mouseUp
When I install the .apk in my Nexus 5 and launch the app, I tap on the button and see the screen flash black momentarily. (I think this is a bug someone else reported and maybe if I alter my script I can prevent that flash. However, no audio file plays. I'm at a loss to understand what I'm doing wrong here.
Thanks,
Barry
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: the media player not working on android??
Hi Barry,
You don't show the quotes around the engine ("engine") and missing the slash before assets ("/assets...").
And does your filename actually contain (96kb)??
Forget looking at the package.
And as I said, for starters just use the single file and not a folder.
Simon
Edit; If you are doing nothing more then playing a sound then this is easier
play specialFolderPath("engine") & "/myBest.mp3"
You don't show the quotes around the engine ("engine") and missing the slash before assets ("/assets...").
And does your filename actually contain (96kb)??
Forget looking at the package.
And as I said, for starters just use the single file and not a folder.
Simon
Edit; If you are doing nothing more then playing a sound then this is easier
play specialFolderPath("engine") & "/myBest.mp3"
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: the media player not working on android??
Simon,
I added the quotes and the slash. No sound.
I then changed that line of code as (I think) you were suggesting:
Again, no sound (but I still get that black flash regardless).
Any other suggestions? I'll keep coding.
Barry
PS - Yes, the filename I show is correct with the (96kb) included in the name.
I added the quotes and the slash. No sound.
I then changed that line of code as (I think) you were suggesting:
Code: Select all
mobileControlSet "player1" , "filename" , specialFolderPath("engine") & "/Click(96kb).mp3"
Any other suggestions? I'll keep coding.
Barry
PS - Yes, the filename I show is correct with the (96kb) included in the name.
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: the media player not working on android??
On a hunch, I tried a longer sound as the "click" sound was only .13 sec long. I replaced it with another sound that was about 4 seconds long (and modified the filename in the script accordingly. No luck. Still no sound.
Barry
Barry
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: the media player not working on android??
Hi Barry,
Try this it's running here on Android.
Extract the whole folder so that the sound file can be attached.
Simon
Try this it's running here on Android.
Extract the whole folder so that the sound file can be attached.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: the media player not working on android??
It worked. Now I'm really confused.
Nowhere in your stack do I see anything like the "mobileControlSet" or "mobileControlDo" commands that I used in my stack (and that I thought were mandatory in Android). All I see is the play command. Is that it?
Nowhere in your stack do I see anything like the "mobileControlSet" or "mobileControlDo" commands that I used in my stack (and that I thought were mandatory in Android). All I see is the play command. Is that it?
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: the media player not working on android??
Yeppers!
Now note that the voice.mp3 was not in a subfolder... that is your next test.
Simon
Now note that the voice.mp3 was not in a subfolder... that is your next test.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: the media player not working on android??
Yes; my audio file wasn't in the same folder as my stack so that's undoubtedly why there was a more complicated path. I'll report back when I try this on my stack. Thanks very much for your time and effort on my behalf.
Barry
Barry