Skip to content

Commit

Permalink
升级 ExoPlayer 至 2.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Doikki committed Jul 1, 2022
1 parent 04a8414 commit cb4d292
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion constants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project.ext {
compileSdkVersion = 31
buildToolsVersion = '33.0.0'

exoPlayerVersion = '2.17.1'
exoPlayerVersion = '2.18.0'

annotation = 'androidx.annotation:annotation:1.1.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,24 @@ public MediaSource getMediaSource(String uri, Map<String, String> headers, boole
setHeaders(headers);
}
switch (contentType) {
case C.TYPE_DASH:
case C.CONTENT_TYPE_DASH:
return new DashMediaSource.Factory(factory).createMediaSource(MediaItem.fromUri(contentUri));
case C.TYPE_HLS:
case C.CONTENT_TYPE_HLS:
return new HlsMediaSource.Factory(factory).createMediaSource(MediaItem.fromUri(contentUri));
default:
case C.TYPE_OTHER:
case C.CONTENT_TYPE_OTHER:
return new ProgressiveMediaSource.Factory(factory).createMediaSource(MediaItem.fromUri(contentUri));
}
}

private int inferContentType(String fileName) {
fileName = fileName.toLowerCase();
if (fileName.contains(".mpd")) {
return C.TYPE_DASH;
return C.CONTENT_TYPE_DASH;
} else if (fileName.contains(".m3u8")) {
return C.TYPE_HLS;
return C.CONTENT_TYPE_HLS;
} else {
return C.TYPE_OTHER;
return C.CONTENT_TYPE_OTHER;
}
}

Expand Down

0 comments on commit cb4d292

Please sign in to comment.