I want to play a sound in an app im writing as part of my learning curve.
Im using eclipse on Ubuntu for 2.1, and have the track.ogg file in the assets directory.
How does one go about playing the track when the program starts?
I know its a combination of
but Im unsure how this works if theres more than 1 sound file.
I found many conflicting samples of code online and id like clarification.
Some of the different ways of doing this include::
Ive found some info at MediaPlayer | Android Developers, android.net.Uri) BUT i cant find any code samples for setDataSource
Any pointers?
Thanks in advance,
GIR
Im using eclipse on Ubuntu for 2.1, and have the track.ogg file in the assets directory.
How does one go about playing the track when the program starts?
I know its a combination of
Code:
R.raw.soundfile
I found many conflicting samples of code online and id like clarification.
Some of the different ways of doing this include::
Code:
aPlayer.play(mContext, Uri.parse("android.resource://"+PACKAGE_NAME+"/"+R.raw.soundfile), false, AudioManager.STREAM_SYSTEM);
Code:
mSoundManager.addSound(1, R.raw.sound);
Code:
mp.setDataSource(PATH_TO_FILE);
Ive found some info at MediaPlayer | Android Developers, android.net.Uri) BUT i cant find any code samples for setDataSource
Any pointers?
Thanks in advance,
GIR