In the meantime the abomination belows works. I know: "...private
api...might break....evil...don't do this...."
What's really missing is a public API to enumerate decoders and their
capabilities (in particular is decoding supported over HTTP).
public Boolean isWMASupported() {
try {
Class decoderCapabilitiesClass =
Class.forName("android.media.DecoderCapabilities");
Class audioDecoderClass =
Class.forName("android.media.DecoderCapabilities$AudioDecoder");
Object constants[] =
audioDecoderClass.getEnumConstants();
if(constants == null || constants.length == 0) return
null;
Object AUDIO_DECODER_WMA = constants[0];
Method getAudioDecodersMethod =
decoderCapabilitiesClass.getMethod("getAudioDecoders");
List decoders =
(List)getAudioDecodersMethod.invoke(null);
for(Object decoder : decoders) {
if(decoder.equals(AUDIO_DECODER_WMA)) return
true;
}
return false;
} catch (Exception e) {
return null;
}
}
On Aug 24, 12:51 pm, Mark Murphy <[email protected]> wrote:
> On Wed, Aug 24, 2011 at 4:39 AM, b0b <[email protected]> wrote:
> > If only google in its immense wisdom had provided
> > MediaPlayer.isMimeTypeSupported()...
>
> Yes, it's a stunning omission.
>
> --
> Mark Murphy (a Commons
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android App Developer Books:http://commonsware.com/books
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en