com.google.android.exoplayer.upstream.UriDataSource Java Examples

The following examples show how to use com.google.android.exoplayer.upstream.UriDataSource. 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: HlsRendererBuilder.java    From Exoplayer_VLC with Apache License 2.0 6 votes vote down vote up
@Override
public void onManifest(String contentId, HlsPlaylist manifest) {
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

  DataSource dataSource = new UriDataSource(userAgent, bandwidthMeter);
  HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter, null,
      HlsChunkSource.ADAPTIVE_MODE_SPLICE);
  HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, true, 3);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
      MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(), player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);

  MetadataTrackRenderer<Map<String, Object>> id3Renderer =
      new MetadataTrackRenderer<Map<String, Object>>(sampleSource, new Id3Parser(),
          player.getId3MetadataRenderer(), player.getMainHandler().getLooper());

  Eia608TrackRenderer closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TIMED_METADATA] = id3Renderer;
  renderers[DemoPlayer.TYPE_TEXT] = closedCaptionRenderer;
  callback.onRenderers(null, null, renderers);
}