Android TTS stops music player
In my application, I use
Intent checkIntent = new Intent();
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);
for texttospeech output in my application.
When I start the android music player and am listening to music and then start my application the music instantly quits playing. (HTC Desire)
How do I resolve that the music continues to play?
CatLog:
10-07 08:39:33.783: ERROR/Tialawl.FindYourRun(11382): before Intent
10-07 08:39:33.793: ERROR/Tialawl.FindYourRun(11382): before check
10-07 08:39:33.793: ERROR/Tialawl.FindYourRun(11382): before start
10-07 08:39:33.793: INFO/ActivityManager(96): Starting activity: Intent { act=android.speech.tts.engine.CHECK_TTS_DATA cmp=com.svox.pico/.CheckVoiceData }
10-07 08:39:33.873: INFO/MediaPlaybackService(6625): get ACTION_MEDIA_MOUNTED signal...
10-07 08:39:33.873: DEBUG/MediaPlaybackService(6625): reloadQueue(), (q != null && q.length() > 1)...
10-07 08:39:33.873: DEBUG/MediaPlaybackService(6625): setCategory(0, -1, -1, -2, , -1)
10-07 08:39:33.973: INFO/MediaPlayer(6625): MediaPlayer reset()
10-07 08:39:33.983: VERBOSE/MediaPlayerService(67): [166] reset
10-07 08:39:33.983: DEBUG/AwesomePlayer(67): [U5B] reset (382)
10-07 08:39:33.983: DEBUG/AwesomePlayer(67): [U5B] reset_l (388)
10-07 08:39:33.983: WARN/TimedEventQueue(67): Event 212 was not found in the queue, already cancelled?
10-07 08:39:33.983: VERBOSE/AudioSink(67): stop
10-07 08:39:33.983: VERBOSE/AudioSink(67): close
10-07 08:39:33.983: DEBUG/AwesomePlayer(67): [U5B] reset_l (478)
10-07 08:39:34.003: DEBUG/MediaPlaybackService(6625): setDataSource path=content://media/external/audio/media/80
10-07 08:39:34.003: INFO/MediaPlayer(6625): MediaPlayer reset()
10-07 08:39:34.003: INFO/MediaPlayer(6625): MediaPlayer setDataSource(context, uri)
10-07 08:39:34.003: INFO/MediaPlayer(6625): MediaPlayer setDataSource(context, uri,headers)
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): Client(167) constructor
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): Create new client(167) from pid 6625, fd=27, offset=0, lengt开发者_JAVA百科h=576460752303423487
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): setDataSource fd=27, offset=0, length=576460752303423487
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): st_dev = 45825
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): st_mode = 32829
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): st_uid = 1000
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): st_gid = 1015
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): st_size = 3876992
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): calculated length = 3876992
10-07 08:39:34.013: VERBOSE/AudioCache(67): We only support url check function now.
10-07 08:39:34.013: VERBOSE/AudioCache(67): isQCPFileFormat() url=(null)
10-07 08:39:34.013: INFO/(67): Has ID3 info, size = 24624
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): player type = 4
10-07 08:39:34.013: DEBUG/MediaPlayerService(67): player type = STAGEFRIGHT_PLAYER
10-07 08:39:34.013: VERBOSE/MediaPlayerService(67): create StagefrightPlayer
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset (382)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (388)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (478)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] setDataSource (319)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (388)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (478)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] setDataSource_l (339)
10-07 08:39:34.023: DEBUG/MediaExtractor(67): [U5B] Create (47)
10-07 08:39:34.023: VERBOSE/MediaExtractor(67): Autodetected media content as 'audio/mpeg' with confidence 0.30
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] setDataSource_l (350)
10-07 08:39:34.023: VERBOSE/MediaPlayerService(67): disconnect(166) from pid 6625
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset (382)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (388)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (478)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset (382)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (388)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (478)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset (382)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (388)
10-07 08:39:34.023: DEBUG/AwesomePlayer(67): [U5B] reset_l (478)
10-07 08:39:34.023: DEBUG/MediaPlaybackService(6625): setDataSource finished
10-07 08:39:34.023: DEBUG/MediaPlaybackService(6625): prepare
10-07 08:39:34.023: VERBOSE/MediaPlayerService(67): [167] setAudioStreamType(3)
10-07 08:39:34.023: VERBOSE/MediaPlayerService(67): Client(166) destructor pid = 6625
10-07 08:39:34.023: VERBOSE/AudioSink(67): close
10-07 08:39:34.023: VERBOSE/MediaPlayerService(67): disconnect(166) from pid 6625
10-07 08:39:34.023: VERBOSE/MediaPlayerService(67): [167] prepareAsync
10-07 08:39:34.023: VERBOSE/MediaPlayerService(67): [167] notify (0x41690, 5, 0, 0)
10-07 08:39:34.033: VERBOSE/AlarmManager(96): Adding Alarm{466033b8 type 2 com.google.android.location} Jan. 02 07:15:53 nachm.
10-07 08:39:34.043: VERBOSE/MediaPlayerService(67): [167] notify (0x41690, 1, 0, 0)
10-07 08:39:34.043: DEBUG/MediaPlaybackService(6625): prepare finished
10-07 08:39:34.043: VERBOSE/MediaPlayerService(67): getDuration
10-07 08:39:34.043: VERBOSE/MediaPlayerService(67): [167] getDuration = 225000
10-07 08:39:34.043: DEBUG/MediaPlaybackService(6625): mMediaPlayer.getDuration(): 225000
10-07 08:39:34.043: DEBUG/MediaPlaybackService(6625): mMediaPlayer.getDuration(): 225000
10-07 08:39:34.043: VERBOSE/MediaPlayerService(67): [167] seekTo(0)
10-07 08:39:34.043: VERBOSE/MediaPlayerService(67): [167] notify (0x41690, 4, 0, 0)
10-07 08:39:34.053: INFO/EMMC(396): Action mounted + path: /mnt/sdcard
10-07 08:39:34.083: ERROR/MediaScannerService(396): Failed to delete file /data/data/com.android.providers.media/pause_scan
10-07 08:39:34.083: INFO/ActivityManager(96): Displayed activity com.tialawl.findyourrun/.FindYourRun: 1448 ms (total 1448 ms)
10-07 08:39:34.133: ERROR/Tialawl.FindYourRun(11382): onActivityResult
I'm assuming you're running 2.2 on your Desire, and that you'll get the same problem with tts in Navigation.
You can work around the issue by using Music Mod instead of the stock player, or by rooting and upgrading to 2.3. My understanding is that 2.2 has both an old and a new way of doing sound and voice-overs, and while the TTS supports the new way, the player that ships with the Desire doesn't.
精彩评论