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 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
-~----------~----~----~----~------~----~------~--~---