public void buildRenderers(EMExoPlayer player, RendererBuilderCallback callback) {
    // Create the Sample Source to be used by the renderers
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
    DefaultBandwidthMeter bandwidthMeter =
        new DefaultBandwidthMeter(player.getMainHandler(), player);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);

    ExtractorSampleSource sampleSource =
        new ExtractorSampleSource(
            Uri.parse(MediaUtil.getUriWithProtocol(uri)),
            dataSource,
            allocator,
            BUFFER_SEGMENT_SIZE * BUFFER_SEGMENTS,
            getExtractor(uri, requestedDefaultType));

    // Create the Renderers
    MediaCodecVideoTrackRenderer videoRenderer =
        new MediaCodecVideoTrackRenderer(
            sampleSource,
            null,
            true,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT,
            MAX_JOIN_TIME,
            null,
            player.getMainHandler(),
            player,
            DROPPED_FRAME_NOTIFICATION_AMOUNT);

    EMMediaCodecAudioTrackRenderer audioRenderer =
        new EMMediaCodecAudioTrackRenderer(
            sampleSource, null, true, player.getMainHandler(), player);

    // Create the Render list to send to the callback
    TrackRenderer[] renderers = new TrackRenderer[EMExoPlayer.RENDER_COUNT];
    renderers[EMExoPlayer.RENDER_VIDEO_INDEX] = videoRenderer;
    renderers[EMExoPlayer.RENDER_AUDIO_INDEX] = audioRenderer;
    callback.onRenderers(null, null, renderers, bandwidthMeter);
  }
 /**
  * Retrieves the extractor to use with the specified mediaUri
  *
  * @param mediaUri The uri to get the extractor for
  * @param defaultType The media type to use if we can't determine the type
  * @return The Extractor for the specified mediaUri
  */
 protected Extractor getExtractor(String mediaUri, MediaUtil.MediaType defaultType) {
   return getExtractor(MediaUtil.getMediaType(mediaUri), defaultType);
 }