Use DASH first instead of HLS and YouTube's DASH parser for lives
This commit is contained in:
parent
4b88b9faff
commit
8edbc1b8d9
2 changed files with 16 additions and 4 deletions
|
|
@ -129,6 +129,13 @@ public class PlayerDataSource {
|
||||||
getDefaultDashChunkSourceFactory(cachelessDataSourceFactory),
|
getDefaultDashChunkSourceFactory(cachelessDataSourceFactory),
|
||||||
cachelessDataSourceFactory);
|
cachelessDataSourceFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DashMediaSource.Factory getLiveYoutubeDashMediaSourceFactory() {
|
||||||
|
return new DashMediaSource.Factory(
|
||||||
|
getDefaultDashChunkSourceFactory(cachelessDataSourceFactory),
|
||||||
|
cachelessDataSourceFactory)
|
||||||
|
.setManifestParser(new YoutubeDashLiveManifestParser());
|
||||||
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,12 +201,13 @@ public interface PlaybackResolver extends Resolver<StreamInfo, MediaSource> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final StreamInfoTag tag = StreamInfoTag.of(info);
|
final StreamInfoTag tag = StreamInfoTag.of(info);
|
||||||
if (!info.getHlsUrl().isEmpty()) {
|
if (!info.getDashMpdUrl().isEmpty()) {
|
||||||
return buildLiveMediaSource(dataSource, info.getHlsUrl(), C.CONTENT_TYPE_HLS, tag);
|
|
||||||
} else if (!info.getDashMpdUrl().isEmpty()) {
|
|
||||||
return buildLiveMediaSource(
|
return buildLiveMediaSource(
|
||||||
dataSource, info.getDashMpdUrl(), C.CONTENT_TYPE_DASH, tag);
|
dataSource, info.getDashMpdUrl(), C.CONTENT_TYPE_DASH, tag);
|
||||||
}
|
}
|
||||||
|
if (!info.getHlsUrl().isEmpty()) {
|
||||||
|
return buildLiveMediaSource(dataSource, info.getHlsUrl(), C.CONTENT_TYPE_HLS, tag);
|
||||||
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
Log.w(TAG, "Error when generating live media source, falling back to standard sources",
|
Log.w(TAG, "Error when generating live media source, falling back to standard sources",
|
||||||
e);
|
e);
|
||||||
|
|
@ -225,7 +226,11 @@ public interface PlaybackResolver extends Resolver<StreamInfo, MediaSource> {
|
||||||
factory = dataSource.getLiveSsMediaSourceFactory();
|
factory = dataSource.getLiveSsMediaSourceFactory();
|
||||||
break;
|
break;
|
||||||
case C.CONTENT_TYPE_DASH:
|
case C.CONTENT_TYPE_DASH:
|
||||||
factory = dataSource.getLiveDashMediaSourceFactory();
|
if (metadata.getServiceId() == ServiceList.YouTube.getServiceId()) {
|
||||||
|
factory = dataSource.getLiveYoutubeDashMediaSourceFactory();
|
||||||
|
} else {
|
||||||
|
factory = dataSource.getLiveDashMediaSourceFactory();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case C.CONTENT_TYPE_HLS:
|
case C.CONTENT_TYPE_HLS:
|
||||||
factory = dataSource.getLiveHlsMediaSourceFactory();
|
factory = dataSource.getLiveHlsMediaSourceFactory();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue