Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Audio plays in emulator but not on physical device

Audio plays in emulator but not on physical device

All your problems with Audio, Video and Images.

Audio plays in emulator but not on physical device

Postby Terrormaster » Tue Feb 02, 2010 7:39 pm

Hi, fairly new android developer, long time software engineer.

A friend of mine asked me to write a simple single sound soundboard for him. I put the basics together and got it running in the emulator with little to no trouble at all. However when I install the app onto my Droid Eris I get no audio playback. I get no errors and the app seems to function fine, just can't hear anything from it. I checked the volume on my phone and even turned it up all the way.

Here's the source:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package montypython.ping;
  3.  
  4.  
  5.  
  6. import android.app.Activity;
  7.  
  8. import android.os.Bundle;
  9.  
  10. import android.view.View;
  11.  
  12. import android.view.View.OnClickListener;
  13.  
  14. import android.media.MediaPlayer;
  15.  
  16.  
  17.  
  18. public class Ping extends Activity implements OnClickListener {
  19.  
  20.         private MediaPlayer mp;
  21.  
  22.        
  23.  
  24.         /** Called when the activity is first created. */
  25.  
  26.     @Override
  27.  
  28.     public void onCreate(Bundle savedInstanceState) {
  29.  
  30.         super.onCreate(savedInstanceState);
  31.  
  32.         setContentView(R.layout.main);
  33.  
  34.         mp = MediaPlayer.create(Ping.this, R.raw.ping);
  35.  
  36.  
  37.  
  38.         View btnPing = findViewById(R.id.btnPing);
  39.  
  40.         btnPing.setOnClickListener(this);
  41.  
  42.        
  43.  
  44.     }
  45.  
  46.    
  47.  
  48.     public void onClick(View v) {
  49.  
  50.         switch (v.getId()) {
  51.  
  52.         case R.id.btnPing:
  53.  
  54.                 mp.seekTo(0);
  55.  
  56.                 mp.start();
  57.  
  58.                 break;
  59.  
  60.         }
  61.  
  62.     }
  63.  
  64. }
  65.  
  66.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


Do I need to set the volume for MediaPlayer separately or something like that? Again this works perfectly fine from the emulator within Eclipse.

Any help or pointer in the right direction would greatly be appreciated.

Thanks,
-Terrormaster
User avatar
Terrormaster
Junior Developer
Junior Developer
 
Posts: 17
Joined: Tue Feb 02, 2010 7:29 pm
Location: New England

Top

Postby Terrormaster » Tue Feb 02, 2010 8:02 pm

LMAO as it always seems to be for me. No sooner I ask someone the answer finds its way into my lap.

Adding the following solved my problem:

setVolumeControlStream(AudioManager.STREAM_MUSIC);

Thanks anyways and hope this helps someone else.

-TM
User avatar
Terrormaster
Junior Developer
Junior Developer
 
Posts: 17
Joined: Tue Feb 02, 2010 7:29 pm
Location: New England

Postby icobasco » Sat Feb 06, 2010 3:55 pm

Hi Terrormaster,
thank you for your sharing.

If you do not use that call, by default if you click on the volume keys you change the RINGER volume. You can change the MULTIMEDIA volume only if you use your call or some media is playing.
User avatar
icobasco
Senior Developer
Senior Developer
 
Posts: 108
Joined: Thu Jun 04, 2009 11:12 am
Location: Italy

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 1 guest