Java 类android.media.MediaPlayer.TrackInfo 实例源码

项目:365browser    文件:MediaPlayerBridge.java   
private boolean hasTrack(int trackType) {
    try {
        TrackInfo trackInfo[] = getLocalPlayer().getTrackInfo();

        // HLS media does not have the track info, so we treat them conservatively.
        if (trackInfo.length == 0) return true;

        for (TrackInfo info : trackInfo) {
            // TODO(zqzhang): may be we can have a histogram recording
            // media track types in the future.
            // See http://crbug.com/571411
            if (trackType == info.getTrackType()) return true;
            if (TrackInfo.MEDIA_TRACK_TYPE_UNKNOWN == info.getTrackType()) return true;
        }
    } catch (RuntimeException e) {
        // Exceptions may come from getTrackInfo (IllegalStateException/RuntimeException), or
        // from some customized OS returning null TrackInfos (NullPointerException).
        return true;
    }
    return false;
}
项目:365browser    文件:MediaPlayerBridge.java   
@CalledByNative
protected boolean hasVideo() {
    return hasTrack(TrackInfo.MEDIA_TRACK_TYPE_VIDEO);
}
项目:365browser    文件:MediaPlayerBridge.java   
@CalledByNative
protected boolean hasAudio() {
    return hasTrack(TrackInfo.MEDIA_TRACK_TYPE_AUDIO);
}
项目:mHealthDroid    文件:Audio.java   
/**
    * Method to get information about the current file
    * @return a TrackInfo array with the information
    */
public TrackInfo[] getTrackInfo() {

    return mediaPlayer.getTrackInfo();
}