public void OnSingleManifest(Object obj)
            {
                var manifest = obj.JavaCast<SmoothStreamingManifest>();
                if (_canceled)
                {
                    return;
                }

                var mainHandler = _player.MainHandler;
                var loadControl = new DefaultLoadControl(new DefaultAllocator(BufferSegmentSize));
                var bandwidthMeter = new DefaultBandwidthMeter(mainHandler, _player);

                // Check drm support if necessary.
                IDrmSessionManager drmSessionManager = null;
                if (manifest.ProtectionElement != null)
                {
                    if (ExoPlayerUtil.SdkInt < 18)
                    {
                        _player.OnRenderersError(
                            new UnsupportedDrmException(UnsupportedDrmException.ReasonUnsupportedScheme));
                        return;
                    }
                    try
                    {
                        drmSessionManager = new StreamingDrmSessionManager(manifest.ProtectionElement.Uuid,
                            _player.PlaybackLooper, _drmCallback, null, _player.MainHandler, _player);
                    }
                    catch (Exception e)
                    {
                        _player.OnRenderersError(e);
                        return;
                    }
                }

                // Build the video renderer.
                var videoDataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var videoChunkSource = new SmoothStreamingChunkSource(_manifestFetcher
                    , DefaultSmoothStreamingTrackSelector.NewVideoInstance(_context, true, false)
                    , videoDataSource
                    , new FormatEvaluatorAdaptiveEvaluator(bandwidthMeter)
                    , LiveEdgeLatencyMs);
                var videoSampleSource = new ChunkSampleSource(videoChunkSource
                    , loadControl
                    , VideoBufferSegments*BufferSegmentSize
                    , mainHandler
                    , _player
                    , VideoPlayer.TypeVideo);
                var videoRenderer = new MediaCodecVideoTrackRenderer(_context
                    , videoSampleSource
                    , MediaCodecSelector.Default
                    , (int)VideoScalingMode.ScaleToFit
                    , 5000
                    , drmSessionManager
                    , true
                    , mainHandler
                    , _player
                    , 50);

                // Build the audio renderer.
                var audioDataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var audioChunkSource = new SmoothStreamingChunkSource(_manifestFetcher
                    , DefaultSmoothStreamingTrackSelector.NewAudioInstance()
                    , audioDataSource
                    , null
                    , LiveEdgeLatencyMs);
                var audioSampleSource = new ChunkSampleSource(audioChunkSource
                    , loadControl
                    , AudioBufferSegments*BufferSegmentSize
                    , mainHandler
                    , _player
                    , VideoPlayer.TypeAudio);
                var audioRenderer = new MediaCodecAudioTrackRenderer(audioSampleSource
                    , MediaCodecSelector.Default
                    , drmSessionManager
                    , true
                    , mainHandler
                    , _player
                    , AudioCapabilities.GetCapabilities(_context)
                    , (int) Stream.Music);

                // Build the text renderer.
                var textDataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var textChunkSource = new SmoothStreamingChunkSource(_manifestFetcher
                    , DefaultSmoothStreamingTrackSelector.NewTextInstance()
                    , textDataSource
                    , null
                    , LiveEdgeLatencyMs);
                var textSampleSource = new ChunkSampleSource(textChunkSource
                    , loadControl
                    , TextBufferSegments*BufferSegmentSize
                    , mainHandler
                    , _player
                    , VideoPlayer.TypeText);
                var textRenderer = new TextTrackRenderer(textSampleSource
                    , _player
                    , mainHandler.Looper);

                // Invoke the callback.
                var renderers = new TrackRenderer[VideoPlayer.RendererCount];
                renderers[VideoPlayer.TypeVideo] = videoRenderer;
                renderers[VideoPlayer.TypeAudio] = audioRenderer;
                renderers[VideoPlayer.TypeText] = textRenderer;
                _player.OnRenderers(renderers, bandwidthMeter);
            }
            public void OnSingleManifest(Object obj)
            {
                var manifest = obj.JavaCast <SmoothStreamingManifest>();

                if (_canceled)
                {
                    return;
                }

                var mainHandler    = _player.MainHandler;
                var loadControl    = new DefaultLoadControl(new DefaultAllocator(BufferSegmentSize));
                var bandwidthMeter = new DefaultBandwidthMeter(mainHandler, _player);

                // Check drm support if necessary.
                IDrmSessionManager drmSessionManager = null;

                if (manifest.ProtectionElement != null)
                {
                    if (ExoPlayerUtil.SdkInt < 18)
                    {
                        _player.OnRenderersError(
                            new UnsupportedDrmException(UnsupportedDrmException.ReasonUnsupportedScheme));
                        return;
                    }
                    try
                    {
                        drmSessionManager = new StreamingDrmSessionManager(manifest.ProtectionElement.Uuid,
                                                                           _player.PlaybackLooper, _drmCallback, null, _player.MainHandler, _player);
                    }
                    catch (Exception e)
                    {
                        _player.OnRenderersError(e);
                        return;
                    }
                }

                // Build the video renderer.
                var videoDataSource  = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var videoChunkSource = new SmoothStreamingChunkSource(_manifestFetcher
                                                                      , DefaultSmoothStreamingTrackSelector.NewVideoInstance(_context, true, false)
                                                                      , videoDataSource
                                                                      , new FormatEvaluatorAdaptiveEvaluator(bandwidthMeter)
                                                                      , LiveEdgeLatencyMs);
                var videoSampleSource = new ChunkSampleSource(videoChunkSource
                                                              , loadControl
                                                              , VideoBufferSegments * BufferSegmentSize
                                                              , mainHandler
                                                              , _player
                                                              , VideoPlayer.TypeVideo);
                var videoRenderer = new MediaCodecVideoTrackRenderer(_context
                                                                     , videoSampleSource
                                                                     , MediaCodecSelector.Default
                                                                     , (int)VideoScalingMode.ScaleToFit
                                                                     , 5000
                                                                     , drmSessionManager
                                                                     , true
                                                                     , mainHandler
                                                                     , _player
                                                                     , 50);

                // Build the audio renderer.
                var audioDataSource  = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var audioChunkSource = new SmoothStreamingChunkSource(_manifestFetcher
                                                                      , DefaultSmoothStreamingTrackSelector.NewAudioInstance()
                                                                      , audioDataSource
                                                                      , null
                                                                      , LiveEdgeLatencyMs);
                var audioSampleSource = new ChunkSampleSource(audioChunkSource
                                                              , loadControl
                                                              , AudioBufferSegments * BufferSegmentSize
                                                              , mainHandler
                                                              , _player
                                                              , VideoPlayer.TypeAudio);
                var audioRenderer = new MediaCodecAudioTrackRenderer(audioSampleSource
                                                                     , MediaCodecSelector.Default
                                                                     , drmSessionManager
                                                                     , true
                                                                     , mainHandler
                                                                     , _player
                                                                     , AudioCapabilities.GetCapabilities(_context)
                                                                     , (int)Stream.Music);

                // Build the text renderer.
                var textDataSource  = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var textChunkSource = new SmoothStreamingChunkSource(_manifestFetcher
                                                                     , DefaultSmoothStreamingTrackSelector.NewTextInstance()
                                                                     , textDataSource
                                                                     , null
                                                                     , LiveEdgeLatencyMs);
                var textSampleSource = new ChunkSampleSource(textChunkSource
                                                             , loadControl
                                                             , TextBufferSegments * BufferSegmentSize
                                                             , mainHandler
                                                             , _player
                                                             , VideoPlayer.TypeText);
                var textRenderer = new TextTrackRenderer(textSampleSource
                                                         , _player
                                                         , mainHandler.Looper);

                // Invoke the callback.
                var renderers = new TrackRenderer[VideoPlayer.RendererCount];

                renderers[VideoPlayer.TypeVideo] = videoRenderer;
                renderers[VideoPlayer.TypeAudio] = audioRenderer;
                renderers[VideoPlayer.TypeText]  = textRenderer;
                _player.OnRenderers(renderers, bandwidthMeter);
            }