We've built workarounds for this problem, and an apparently-related one with the PediaPlayer. They make me uneasy, and I suspect we are really walking around a deeper problem with the MediaPlayer on 1.6.
But, in case anyone else suffers the same issue, these are the two workarounds we have put in place: (1) titleForRingtone fails (as below) when we ask it for titles repeatedly or too quickly. So, we now cache the titles we get back from it, so we never need to ask for the title twice for a single URI. (2) In a related issue, we are getting occasional failure of MediaPlayer.prepare() when we are playing media files, with very similar traces to the titleForRingtone issue. We now close down our MediaPlayer instance when that happens, wait half a second, and try again with a new MediaPlayer. That generally works, presumably because it is allowing time for a previous MediaPlayer to finish doing its cleanup work in the background, but it is obviously a slightly unwholesome fix. I'd still love to find out what has changed in 1.6, and if there is meant to be a tidier way to handle these issues. Thanks, Richard On Oct 20, 12:54 pm, jarkman <jark...@gmail.com> wrote: > We're seeing a problem withRingtone.getTitle() in 1.6. > > Sporadically, getTitle() will return "Unknownringtone" instead of the > proper title. It seems to be timing-dependent, and is most likely to > go wrong when we ask for the title of a tone twice in rapid > succession. Here's a typical log, showing a success followed very > rapidly by a failure: > > 10-20 10:50:41.799: INFO/Utils(902): titleForRingtone looking for uri > content://media/external/audio/media/21 > 10-20 10:50:41.929: INFO/Utils(902): titleForRingtone got Papa's Got a > Brand New Pigbag > 10-20 10:50:42.079: INFO/Utils(902): titleForRingtone looking for uri > content://media/external/audio/media/21 > 10-20 10:50:42.149: ERROR/PlayerDriver(51): Command PLAYER_PREPARE > completed with an error or info PVMFErrResource > 10-20 10:50:42.149: ERROR/MediaPlayer(902): error (1, -17) > 10-20 10:50:42.149: WARN/PlayerDriver(51): > PVMFInfoErrorHandlingComplete > 10-20 10:50:42.159: ERROR/RingtoneManager(902): Failed to > openringtonecontent://media/external/audio/media/21 > 10-20 10:50:42.219: INFO/Utils(902): titleForRingtone got Unknownringtone > > My guess is that the second attempt fails because the first attempt > has not yet finished some cleanup task, closing down a media player or > some such. > > My question is, how can I reliably know when theRingtoneis in a > state where I can safely ask it for its title ? At the moment there is > no solid way for my code to know when it is unsafe to ask, or even to > know when getTitle has definitely failed. > > Any hints about what is going on here would be very welcome. > > Thanks, > > Richard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---