Re: [PhoneGap] PhoneGap Media API Events

388 views
Skip to first unread message

Simon MacDonald

unread,
Aug 15, 2012, 1:12:20 PM8/15/12
to phon...@googlegroups.com
You need to register a status callback on your Media object.

var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]);

Simon Mac Donald
http://hi.im/simonmacdonald


On Mon, Aug 13, 2012 at 5:34 AM, Ahmad Thoriq <thor...@gmail.com> wrote:
> Hello, I'm developing a PhoneGap application for Android and Blackberry
> using the 1.9.0 version.
> In this app, user can listen to a live audio streaming from the Web.
>
> The problem is I want to show some kind of loading screen after the user
> starts the stream (as Internet connection can be unstable therefore user
> might wait for a long time before the audio starts playing).
> How can I do that using PhoneGap Media API?
> I was able to perform a similar thing using HTML5 Audio element by
> registering callbacks for Audio events, such as "playing", "loaded", etc.
> But I want to do something similar using Media API from PhoneGap.
>
> Thank you very much.
>
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>
> To compile in the cloud, check out build.phonegap.com
>
>

Ahmad Thoriq

unread,
Sep 13, 2012, 5:33:20 AM9/13/12
to phon...@googlegroups.com
Thanks for your answer, Simon.
But, can you give some details about the status codes which is returned to the callback?

Ahmad Thoriq

unread,
Sep 13, 2012, 5:53:07 AM9/13/12
to phon...@googlegroups.com
No matter, just searched the cordove source code and here are the codes.

Media.MEDIA_NONE = 0;
Media.MEDIA_STARTING = 1;
Media.MEDIA_RUNNING = 2;
Media.MEDIA_PAUSED = 3;
Media.MEDIA_STOPPED = 4;

I'll try if it works well on my app. :D

Simon MacDonald

unread,
Sep 13, 2012, 9:35:40 AM9/13/12
to phon...@googlegroups.com
You may see an off by one error in those status codes in Android as another state was accidentally inserted in the middle. It's been fixed in later releases so look for 2.1 when it is out very soon.

Simon Mac Donald
http://hi.im/simonmacdonald


Reply all
Reply to author
Forward
0 new messages