Java 类com.google.android.exoplayer2.upstream.DefaultDataSource 实例源码

项目:ExoPlayer-Offline    文件:SampleChooserActivity.java   
@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;
}
项目:transistor    文件:SampleChooserActivity.java   
@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;
}
项目:yjPlay    文件:EncryptedFileDataSourceFactory.java   
@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());
    }
}
项目:yjPlay    文件:JDefaultDataSourceFactory.java   
@Override
public DataSource createDataSource() {
    return new DefaultDataSource(context, new DefaultBandwidthMeter(), baseDataSourceFactory.createDataSource());
}
项目:Cable-Android    文件:AttachmentDataSource.java   
public AttachmentDataSource(DefaultDataSource defaultDataSource, PartDataSource partDataSource) {
  this.defaultDataSource = defaultDataSource;
  this.partDataSource    = partDataSource;
}