Java Code Examples for com.google.android.exoplayer.util.MimeTypes#isAudio()

The following examples show how to use com.google.android.exoplayer.util.MimeTypes#isAudio() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerActivity.java    From Android-Example-HLS-ExoPlayer with Apache License 2.0 6 votes vote down vote up
private static String buildTrackName(MediaFormat format) {
    if (format.adaptive) {
        return "auto";
    }
    String trackName;
    if (MimeTypes.isVideo(format.mimeType)) {
        trackName = joinWithSeparator(joinWithSeparator(buildResolutionString(format),
                buildBitrateString(format)), buildTrackIdString(format));
    } else if (MimeTypes.isAudio(format.mimeType)) {
        trackName = joinWithSeparator(joinWithSeparator(joinWithSeparator(buildLanguageString(format),
                buildAudioPropertyString(format)), buildBitrateString(format)),
                buildTrackIdString(format));
    } else {
        trackName = joinWithSeparator(joinWithSeparator(buildLanguageString(format),
                buildBitrateString(format)), buildTrackIdString(format));
    }
    return trackName.length() == 0 ? "unknown" : trackName;
}
 
Example 2
Source File: MediaPresentationDescriptionParser.java    From Exoplayer_VLC with Apache License 2.0 5 votes vote down vote up
protected int parseAdaptationSetTypeFromMimeType(String mimeType) {
  return TextUtils.isEmpty(mimeType) ? AdaptationSet.TYPE_UNKNOWN
      : MimeTypes.isAudio(mimeType) ? AdaptationSet.TYPE_AUDIO
      : MimeTypes.isVideo(mimeType) ? AdaptationSet.TYPE_VIDEO
      : MimeTypes.isText(mimeType) || MimeTypes.isTtml(mimeType) ? AdaptationSet.TYPE_TEXT
      : AdaptationSet.TYPE_UNKNOWN;
}
 
Example 3
Source File: MediaCodecAudioTrackRenderer.java    From Exoplayer_VLC with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean handlesMimeType(String mimeType) {
  return MimeTypes.isAudio(mimeType) && super.handlesMimeType(mimeType);
}