private MediaPlaylistChunk newMediaPlaylistChunk(int variantIndex) { Uri mediaPlaylistUri = UriUtil.resolveToUri(baseUri, variants[variantIndex].url); DataSpec dataSpec = new DataSpec(mediaPlaylistUri, 0, C.LENGTH_UNBOUNDED, null, DataSpec.FLAG_ALLOW_GZIP); return new MediaPlaylistChunk(dataSource, dataSpec, scratchSpace, playlistParser, variantIndex, mediaPlaylistUri.toString()); }
/** * Builds a uri for requesting the specified chunk of the specified track. * * @param track The index of the track for which to build the URL. * @param chunkIndex The index of the chunk for which to build the URL. * @return The request uri. */ public Uri buildRequestUri(int track, int chunkIndex) { Assertions.checkState(tracks != null); Assertions.checkState(chunkStartTimes != null); Assertions.checkState(chunkIndex < chunkStartTimes.size()); String chunkUrl = chunkTemplate .replace(URL_PLACEHOLDER_BITRATE, Integer.toString(tracks[track].format.bitrate)) .replace(URL_PLACEHOLDER_START_TIME, chunkStartTimes.get(chunkIndex).toString()); return UriUtil.resolveToUri(baseUri, chunkUrl); }
protected static String parseBaseUrl(XmlPullParser xpp, String parentBaseUrl) throws XmlPullParserException, IOException { xpp.next(); return UriUtil.resolve(parentBaseUrl, xpp.getText()); }
/** * Returns the {@link Uri} represented by the instance. * * @return The {@link Uri} represented by the instance. */ public Uri getUri() { return UriUtil.resolveToUri(baseUri, referenceUri); }
/** * Returns the uri represented by the instance as a string. * * @return The uri represented by the instance. */ public String getUriString() { return UriUtil.resolve(baseUri, referenceUri); }