Return empty string instead of null if text track title or language are not set

This commit is contained in:
Hampton Maxwell 2018-06-20 15:46:04 -07:00
parent e684ba65b6
commit b850b31f04

View File

@ -520,9 +520,9 @@ class ReactExoplayerView extends FrameLayout implements
Format format = groups.get(i).getFormat(0); Format format = groups.get(i).getFormat(0);
WritableMap textTrack = Arguments.createMap(); WritableMap textTrack = Arguments.createMap();
textTrack.putInt("index", i); textTrack.putInt("index", i);
textTrack.putString("title", format.id); textTrack.putString("title", format.id != null ? format.id : "");
textTrack.putString("type", format.sampleMimeType); textTrack.putString("type", format.sampleMimeType);
textTrack.putString("language", format.language); textTrack.putString("language", format.language != null ? format.language : "");
textTracks.pushMap(textTrack); textTracks.pushMap(textTrack);
} }
return textTracks; return textTracks;