@Override protected List<SampleGroup> doInBackground(String... uris) { List<SampleGroup> result = new ArrayList<>(); Context context = getApplicationContext(); String userAgent = Util.getUserAgent(context, "ExoPlayerDemo"); DataSource dataSource = new DefaultDataSource(context, null, userAgent, false); for (String uri : uris) { DataSpec dataSpec = new DataSpec(Uri.parse(uri)); InputStream inputStream = new DataSourceInputStream(dataSource, dataSpec); try { readSampleGroups(new JsonReader(new InputStreamReader(inputStream, "UTF-8")), result); } catch (Exception e) { Log.e(TAG, "Error loading sample list: " + uri, e); sawError = true; } finally { Util.closeQuietly(dataSource); } } return result; }
@Override public DataSource createDataSource() { if (null != mCipher) { return new MyDefaultDataSource(context, mCipher, mSecretKeySpec, mIvParameterSpec, mTransferListener, baseDataSourceFactory.createDataSource()); } else if (key != null) { return new Encrypted1FileDataSource(key, new DefaultBandwidthMeter()); } else { return new DefaultDataSource(context, new DefaultBandwidthMeter(), baseDataSourceFactory.createDataSource()); } }
@Override public DataSource createDataSource() { return new DefaultDataSource(context, new DefaultBandwidthMeter(), baseDataSourceFactory.createDataSource()); }
public AttachmentDataSource(DefaultDataSource defaultDataSource, PartDataSource partDataSource) { this.defaultDataSource = defaultDataSource; this.partDataSource = partDataSource; }