andbook!.pdf - Learning Android Get an anddev.org - Android-Shirt Back to index
anddev.org Header Logo
FAQ Search Top rated articles Browse Feeds anddev.org - Authors Contact Details Register Log in

[VIDEO-Tut] - Playing Media(mp3) on the emulator

Goto page Previous  1, 2, 3, 4, 5  Next
 
       anddev.org - Android Development Community | Android Tutorials | Index -> Novice Tutorials
Author Message
Asgard
Junior Developer


Joined: 15 Dec 2007
Posts: 16

PostPosted: Sun Dec 16, 2007 9:50 pm    Post subject: Reply with quote

Hello, plusminus. Thanks for your help Smile

All the ways described above works fine, but I would like to play sound from project res folder, as in your example.

_________________
Catch the moment
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Sun Dec 16, 2007 10:05 pm    Post subject: Reply with quote

Hm,
there is no other solution to load from resource that I am aware of...

Idea Please post your code and OS/SDK/ADT-VErsions ( are you using the new SDK (released yersterday Question) )
Arrow Perhaps someone recognizes the he/she had the same problem and answers.

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cybersat
Freshman


Joined: 18 Dec 2007
Posts: 5

PostPosted: Tue Dec 18, 2007 12:24 pm    Post subject: Can't hear Reply with quote

Installed music player file and program is working , but i can't hear mp3.

I had increased volume in emulator, still no sound.
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Tue Dec 18, 2007 3:44 pm    Post subject: Reply with quote

Hello cybersat,

did you hear the sound the emulator makes when hitting the VolumeUp/Down Buttons Question
did you run the emulator with "-useaudio" Question

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Katharnavas
Senior Developer


Joined: 04 Dec 2007
Posts: 100
Location: India

PostPosted: Wed Dec 19, 2007 5:05 am    Post subject: Reply with quote

I hope he is missing that atleast when volume key is pressed he will hear a music.


plusminus wrote:
Hello cybersat,

did you hear the sound the emulator makes when hitting the VolumeUp/Down Buttons Question
did you run the emulator with "-useaudio" Question

Regards,
plusminus
Back to top
View user's profile Send private message Yahoo Messenger
NumBeast
Freshman


Joined: 09 Dec 2007
Posts: 6

PostPosted: Wed Dec 19, 2007 5:19 am    Post subject: SOLUTION!!!! Reply with quote

I have finally figured out why none of my mp3s were playing. They were not Mp3s. The files I were trying to play were Mono/22050Hz/64kbps/MPEG-1layer2 with the /mp3 extension. reformatting MPEG-1layer3 solves all my problems. YAY!!!!!! Smile Very Happy
Back to top
View user's profile Send private message
R4
Freshman


Joined: 19 Dec 2007
Posts: 3

PostPosted: Wed Dec 19, 2007 9:37 am    Post subject: Reply with quote

Hello,

Similar symptoms to everyone else but in my case the problem was that the mp3 file was too big. The debugger log window showed this message:

Code:
D/asset(555): Data exceeds UNCOMPRESS_DATA_MAX (11960997 vs 1048576)


Simply changing to a smaller (<1M) mp3 file solved the problem. No source code changes to the original at all.

R4
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Wed Dec 19, 2007 6:29 pm    Post subject: Reply with quote

Hello R4,

Yes exactly 1 MB ( == 1.048.576 Bytes )

Why ever they chose that limit ... Rolling Eyes

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gcameo
Once Poster


Joined: 20 Dec 2007
Posts: 1

PostPosted: Thu Dec 20, 2007 5:46 pm    Post subject: APPLICATION CANNOT BE FOUND Reply with quote

After watching the screencast and following the tutorials evrything worked fine but the i could not find the application in the emulator.

I must mention that I did it from commandprompt since I dont have eclipse. Is there a plugin for netbeans
Back to top
View user's profile Send private message
ramgraph1
Experienced Developer


Joined: 09 Jan 2008
Posts: 68

PostPosted: Fri Jan 11, 2008 5:55 am    Post subject: Reply with quote

Is there a way to stop all audio that an activity is running when you quit it? I have a looping mp3 that just keeps playing when I quit and I need to know how to kill it!
Anybody know how?
Thanks
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Fri Jan 11, 2008 11:03 am    Post subject: Reply with quote

Hello ramgraph,

you somewhere created a MediaPlayer object and you can use its stop()-method. Is it not working properly Question

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ramgraph1
Experienced Developer


Joined: 09 Jan 2008
Posts: 68

PostPosted: Fri Jan 11, 2008 2:09 pm    Post subject: Reply with quote

Thanks for responding. I did create a MediaPlayer object but the use of it seems limited to the public void in which I created it so that to access the MediaPlayer I need to call that void again which just creates a new MediaPlayer, it seems. The code UI use is similar to your example above:

Code:
public void onClick(View arg0) {
                    MediaPlayer mp = MediaPlayer.create(MusicPlayer.this,
                              R.raw.everlast);
                    mp.prepare();
                    mp.start();


except instead of setOnCompletionListener I am looping the audio. If I try to use "mp.stop();" from somewhere outside of the onClick where is was created I get "mp cannot be resolved". What code would you use to use another button to stop the audio you start in the code above? Thanks for any light you can shed!
Back to top
View user's profile Send private message
AndreySerj
Junior Developer


Joined: 26 Dec 2007
Posts: 23
Location: Minsk

PostPosted: Thu Jan 17, 2008 11:52 am    Post subject: Reply with quote

Hi All,
While player is running I try to adjust a sound volume by buttons on emulator (on the right side), but nothing happens. How to control a sound volume on device ?
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Thu Jan 17, 2008 9:18 pm    Post subject: Reply with quote

Hello AndreySerj,

Ringing on incoming Voice-Calls works fine for me (changing the volume while its ringing works also)

Perhaps have a look at:
Java:
android.view.IRingerVolume volumeService = android.view.RingerVolumeNative.asInterface(sm.getService("volume"));


Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
AndreySerj
Junior Developer


Joined: 26 Dec 2007
Posts: 23
Location: Minsk

PostPosted: Fri Jan 18, 2008 9:19 am    Post subject: Reply with quote

plusminus wrote:

Ringing on incoming Voice-Calls works fine for me (changing the volume while its ringing works also) ....

Hi plusminus, I mean an audio volume control while playback ...
I found the following solution:
Java:

...
AudioSystem.setVolume(AudioSystem.STREAM_MUSIC, AudioSystem.MAX_VOLUME - step);
...


It work, but when I increase/decrease sound volume by right-side buttons on the emulator I hear both my audio playback and emulator-specific tone.
Back to top
View user's profile Send private message
Display posts from previous:   
       anddev.org - Android Development Community | Android Tutorials | Index -> Novice Tutorials All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


© 2007, Android Development Community
All rights reserved.
Powered by phpBB.