 |
|
|  |
|
 |
8³â Àü |
¸¸¾à ÀÌ ¼Ò¸®¸¦ ³»À彺ÇÇÄ¿·Î ³»°í ½Í´Ù.
±Ùµ¥ ³»À彺ÇÇÄ¿°¡ ¹«½¼ ¸»À̳Ä! ±×³É ´Ù ¶È°°Àº ½ºÇÇÄ¿°¡ ¾Æ´Ï³Ä~!
³Ü ½ºÇÇÄ¿ Àε¥ ±â´ÉÀÌ Á» ´Ù¸¨´Ï´Ù.
¹Ù·Î ÀüÈ ÅëÈ ÇÒ¶§, »ó´ë¹æ ¸ñ¼Ò¸®°¡ µé¸®´Â ½ºÇÇÄ¿°¡ ³»Àå ½ºÇÇÄ¿ ÀÌ°í,
À½¾Ç Àç»ý ¾îÇÿ¡¼ µé¸®´Â À½¾Ç ¼Ò¸®´Â ¿©·¯ºÐÀÌ ¾Ë°í °è½Ã´Â ¿ÜÀå ½ºÇÇÄ¿·Î º¸½Ã¸é µË´Ï´Ù.
µû¶ó¼, ÀüÈ ÅëÈ ÇÒ¶§ ½ºÇÇÄ¿¸¦ ÄÑ¸é ³»Àå ½ºÇÇÄ¿°¡ ¿ÜÀå ½ºÇÇÄ¿·Î ¿Å°ÜÁö°Ô µÇ¾î
¼Ò¸®°¡ Ä¿Áö°Ô µÇ´Â °ÍÀÌÁÒ.
±×·³ ³»Àå ½ºÇÇÄ¿·Î ¾î¶»°Ô ¿¬°á ½Ãų±î¿ä?
¾Æ·¡ ÇÔ¼ö·Î ³¡ÀÔ´Ï´Ù.
// º¸À̽ºÄÝ ºÎºÐ Å×½ºÆ®
public void playTest(Activity activity) {
// ½ºÇÇÄ¿ ¿Â
// AudioManager audioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
// audioManager.setSpeakerphoneOn(true);
try {
AssetFileDescriptor afd = activity.getAssets()
.openFd("sounds/test.mp3");
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
afd.close();
mMediaPlayer.prepare();
mMediaPlayer.start();
} catch (Exception e) {
if (RingQConfig.DEBUG) e.printStackTrace();
}
}
Âü°í·Î test.mp3 ÆÄÀÏÀº app/src/main/assets/sounds/test.mp3 ¿¡ À§Ä¡ÇØ ÀÖ½À´Ï´Ù.
À§¿Í °°ÀÌ assets Æú´õ¿¡ ÀÕ´Â mp3 ÆÄÀÏÀ» Àоî¿Í¼ MediaPlayer ¿¡ ¿¬°á ½Ãŵ´Ï´Ù.
À̺κбîÁö´Â ÀϹÝÀûÀ¸·Î MediaPlayer¸¦ ½ÇÇàÇÏ´Â ºÎºÐ°ú °°½À´Ï´Ù.
Ʋ¸° ºÎºÐÀº µü! setAudioStreamType ÇÔ¼ö°¡ Ãß°¡µÈ °ÍÀÔ´Ï´Ù.
AudioManagver.STREAM_VOICE_CALL ·Î ÁöÁ¤ÇÏ´Â ¼ø°£ ³»Àå ½ºÇÇÄ¿·Î MediaPlayer°¡ ÁöÁ¤µÇ¾î
Ç÷¹ÀÌ°¡ µÇ´Â °ÍÀÌÁÒ.
¼Ò½º¸¦ º¸´Ï ¿©·¯ ŸÀÔÀÇ StreamÀÌ Àֳ׿ä.
/** The audio stream for phone calls */
public static final int STREAM_VOICE_CALL = AudioSystem.STREAM_VOICE_CALL;
/** The audio stream for system sounds */
public static final int STREAM_SYSTEM = AudioSystem.STREAM_SYSTEM;
/** The audio stream for the phone ring */
public static final int STREAM_RING = AudioSystem.STREAM_RING;
/** The audio stream for music playback */
public static final int STREAM_MUSIC = AudioSystem.STREAM_MUSIC;
/** The audio stream for alarms */
public static final int STREAM_ALARM = AudioSystem.STREAM_ALARM;
/** The audio stream for notifications */
public static final int STREAM_NOTIFICATION = AudioSystem.STREAM_NOTIFICATION;
/** @hide The audio stream for phone calls when connected to bluetooth */
public static final int STREAM_BLUETOOTH_SCO = AudioSystem.STREAM_BLUETOOTH_SCO;
/** @hide The audio stream for enforced system sounds in certain countries (e.g camera in Japan) */
public static final int STREAM_SYSTEM_ENFORCED = AudioSystem.STREAM_SYSTEM_ENFORCED;
/** The audio stream for DTMF Tones */
public static final int STREAM_DTMF = AudioSystem.STREAM_DTMF;
/** @hide The audio stream for text to speech (TTS) */
public static final int STREAM_TTS = AudioSystem.STREAM_TTS;
±×¸®°í ÇÔ¼ö¿¡¼ ÁÖ¼® ó¸®µÈ ºÎºÐÀÌ Àִµ¥¿ä. ÇØ´ç ºÎºÐÀ» È£Ãâ ÇÏ¸é ³»Àå ½ºÇÇÄ¿¿¡¼ ¿ÜÀå ½ºÇÇÄ¿·Î º¯°æ µË´Ï´Ù. µü 2ÁÙ¸¸ ³Ö¾îÁÖ½Ã¸é µÇ¿ä ¤¾
AudioManager audioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
audioManager.setSpeakerphoneOn(true);
Âü°íÇϽøé ÁÁÀ» µíÇÕ´Ï´Ù. |
|
̵̧ : 453 |
̵̧
¸ñ·Ï
|
|
|  |
|