media-widget/src/androidTest/java/androidx/media/widget/MediaUtils2.java
static boolean hasCodecsForMedia(MediaExtractor ex) {
        for (int i = 0; i < ex.getTrackCount(); ++i) {
            MediaFormat format = ex.getTrackFormat(i);
            // only check for audio and video codecs
            String mime = format.getString(MediaFormat.KEY_MIME).toLowerCase();
            if (!mime.startsWith("audio/") && !mime.startsWith("video/")) {
                continue;
            }
            if (!canDecode(format)) {
                return false;
            }
        }
        return true;
    }
/**
     * Returns true iff all audio and video tracks are supported
     */
Returns true iff all audio and video tracks are supported
Returns true iff all audio and video tracks are supported
static boolean hasCodecsForMedia(MediaExtractor ex) {
        for (int i = 0; i < ex.getTrackCount(); ++i) {
            MediaFormat format = ex.getTrackFormat(i);
            String mime = format.getString(MediaFormat.KEY_MIME).toLowerCase();
            if (!mime.startsWith("audio/") && !mime.startsWith("video/")) {
                continue;
            }
            if (!canDecode(format)) {
                return false;
            }
        }
        return true;
    }
static boolean hasCodecsForMedia ( MediaExtractor ex ) { for ( int i = 0 ; i < ex . getTrackCount ( ) ; ++ i ) { MediaFormat format = ex . getTrackFormat ( i ) ; String mime = format . getString ( MediaFormat . KEY_MIME ) . toLowerCase ( ) ; if ( ! mime . startsWith ( "audio/" ) && ! mime . startsWith ( "video/" ) ) { continue ; } if ( ! canDecode ( format ) ) { return false ; } } return true ; }
Returns true iff all audio and video tracks are supported
Returns true iff all audio and video tracks are supported
// only check for audio and video codecs