Are you sure that AUDIO_DECODER_WMA will always be the 0th indexed
object in the constants array? I haven't looked at the code, and I
haven't tried getting at an enum via reflection. That's the big thing
that leaps out at me (besides the private APIs issue you mention).

On Wed, Aug 24, 2011 at 7:13 AM, b0b <pujos.mich...@gmail.com> wrote:
> 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 <mmur...@commonsware.com> wrote:
>> On Wed, Aug 24, 2011 at 4:39 AM, b0b <pujos.mich...@gmail.com> 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 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
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Oslo: http://bit.ly/fjBo24

-- 
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

Reply via email to