I have sample.cpp file which has a function void PlayAudio(char * url). I need to play the audio file using android media framework API. I am new to Java and android. Please help me. I am investigating on how my library which is in C++ can be used to call android media framework api. Thanks & Regards, P.Sriniamul --- On Tue, 27/1/09, [email protected] <[email protected]> wrote:
From: [email protected] <[email protected]> Subject: Re: sample piece of code to call media framework api To: "android-framework" <[email protected]> Date: Tuesday, 27 January, 2009, 9:16 PM You appear to be confusing the C++ and Java languages. Or at least, you say you have a sample.cpp file, and use pointers in your code, however some of the APIs you are calling don't exist in the native Android code (in particular, all of the set***Listener() calls). What are you trying to do exactly? On Jan 26, 10:26 pm, srini amul <[email protected]> wrote: > Hi all, > I have a sample.cpp file which has playAudio() function in it. PlayAudio() is used to play a audio file. > --------------------------------------------------------------------------------------------------------- > Please check the below code: > ***************************** > > void playAudio (char* url) > { > MediaPlayer *mp = new MediaPlayer(); > if (NULL != mp) > { > String filePath (url, 0, strlen(url)); > mp->setDataSource(filePath); > mp->prepare(); > mp->setAudioStreamType(AudioManager.STREAM_MUSIC); > mp->setOnBufferingUpdateListener(this); > mp->setOnCompletionListener(this); > mp->setOnErrorListener(this); > mp->setOnPreparedListener(this); > } } > > void onBufferingUpdate (MediaPlayer mp, int percent) > { > > > } > > void onCompletion(MediaPlayer mp) > {} > > boolean onError(MediaPlayer mp, int what, int extra) > {} > > void onPrepared(MediaPlayer mp) > { > mp->start();} > > --------------------------------------------------------------------------------------------------------- > Question: > ********* > a) Can i call new MediaPlayer() in sample.cpp file ? > b) How can i import android.media.mediaPlayer package class in sample.cpp file? > c) How can i handle a onBufferingUpdate() & onCompletion() & onError() & onPrepared() message from media player library ? > > -------------------------------------------------------------------------------------------------------------- > > Thanks & Regards, > P.Sriniamul > > Add more friends to your messenger and enjoy! Go tohttp://messenger.yahoo.com/invite/ Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "android-framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-framework?hl=en -~----------~----~----~----~------~----~------~--~---
