-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Labels
Description
MediaItem.Builder builder = new MediaItem.Builder();
// OK
builder
.setUri(uri)
.setMimeType(uri_mimeType)
.setDrmUuid(Util.getDrmUuid(drm_scheme))
.setDrmLicenseUri(drm_license_server)
.setDrmForceDefaultLicenseUri(false)
.setDrmSessionForClearPeriods(false)
.setDrmPlayClearContentWithoutKey(true)
.setDrmMultiSession(true)
.setDrmLicenseRequestHeaders(drmHeadersMap);
// not OK
builder
.setClipEndPositionMs(stopPosition)
.setClipRelativeToDefaultPosition(true);
// not OK
builder
.setSubtitleConfigurations(subtitleConfigurations);
MediaItem mediaItem = builder.build();
TrackSelectionParameters trackSelectionParameters = DownloadHelper.getDefaultTrackSelectorParameters(context);
DownloadHelper downloadHelper = DownloadHelper.forMediaItem(mediaItem, trackSelectionParameters, renderersFactory, httpDataSourceFactory);
DownloadRequest downloadRequest = downloadHelper.getDownloadRequest( Util.getUtf8Bytes( mediaItem.playbackProperties.uri.toString() ) );
if (downloadRequest.streamKeys.isEmpty()) {
// not OK
}
DownloadService.sendAddDownload(context, MyDownloadService.class, downloadRequest, /* foreground= */ false);- calls to any/all of the
MediaItem.Buildermethods that are marked "not OK", result in:downloadRequest.streamKeys.isEmpty() == truetrackSelectionParametersare ignored- every stream in an adaptive manifest will download
- by avoiding calls that are "not OK" to
MediaItem.Builder..downloadRequest.streamKeys.isEmpty() == falsetrackSelectionParametersare not ignored- only the enabled (or "default") tracks are downloaded
- however, this matter is farther complicated..
- when both..
trackSelectionParametersare configured by the user,
and obtained fromplayer.getTrackSelectionParameters()for the media that is currently playing- the media that is currently playing is a
MergingMediaSource,
and includes at least one external subtitles file (ex: .srt)
trackSelectionParametersobtained in this way are ignored..- only the "default" tracks are downloaded
- when both..
Is there a way to sanitize the instance of TrackSelectionParameters..
obtained from player.getTrackSelectionParameters() when both of the above conditions are true..
that would allow the correct (ie: manually selected) video stream(s) to download?
For example:
TrackSelectionParameters trackSelectionParameters = player.getTrackSelectionParameters()
.buildUpon()
.XXX('???')
.build();MargaritaStarkova