Specify the text track type without any conversion

This commit is contained in:
Hampton Maxwell 2018-06-12 20:57:30 -07:00
parent e2ea849d9e
commit d47a6ed424

View File

@ -307,18 +307,7 @@ class ReactExoplayerView extends FrameLayout implements
} }
private MediaSource buildTextSource(String title, Uri uri, String mimeType, String language) { private MediaSource buildTextSource(String title, Uri uri, String mimeType, String language) {
String sampleType; Format textFormat = Format.createTextSampleFormat(title, mimeType, Format.NO_VALUE, language);
switch (mimeType) {
case "srt":
sampleType = MimeTypes.APPLICATION_SUBRIP;
break;
case "vtt":
sampleType = MimeTypes.TEXT_VTT;
break;
default:
return null;
}
Format textFormat = Format.createTextSampleFormat(title, sampleType, Format.NO_VALUE, language);
return new SingleSampleMediaSource(uri, mediaDataSourceFactory, textFormat, C.TIME_UNSET); return new SingleSampleMediaSource(uri, mediaDataSourceFactory, textFormat, C.TIME_UNSET);
} }