com.google.android.exoplayer2.upstream.DefaultDataSource Java Examples

The following examples show how to use com.google.android.exoplayer2.upstream.DefaultDataSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SampleChooserActivity.java    From ExoPlayer-Offline with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: AttachmentDataSource.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
public AttachmentDataSource(DefaultDataSource defaultDataSource,
                            PartDataSource partDataSource,
                            BlobDataSource blobDataSource)
{
  this.defaultDataSource = defaultDataSource;
  this.partDataSource    = partDataSource;
  this.blobDataSource    = blobDataSource;
}
 
Example #3
Source File: AttachmentDataSource.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
public AttachmentDataSource(DefaultDataSource defaultDataSource, PartDataSource partDataSource) {
  this.defaultDataSource = defaultDataSource;
  this.partDataSource    = partDataSource;
}
 
Example #4
Source File: AttachmentDataSource.java    From deltachat-android with GNU General Public License v3.0 4 votes vote down vote up
public AttachmentDataSource(DefaultDataSource defaultDataSource) {
  this.defaultDataSource = defaultDataSource;
}