/// <summary>
 /// Invoked with the results from a <see cref="IRendererBuilder"/>.
 /// </summary>
 /// <param name="renderers">Renderers indexed by <see cref="MvxVideoPlayer"/>. TYPE_* constants. An individual element may be null if there do not exist tracks of the corresponding type.</param>
 /// <param name="bandwidthMeter">Provides an estimate of the currently available bandwidth. May be null.</param>
 internal void OnRenderers(TrackRenderer[] renderers, IBandwidthMeter bandwidthMeter)
 {
     for (var i = 0; i < RendererCount; i++)
     {
         if (renderers[i] == null)
         {
             // Convert a null renderer to a dummy renderer.
             renderers[i] = new DummyTrackRenderer();
         }
     }
     // Complete preparation.
     _videoRenderer = renderers[TypeVideo];
     _codecCounters = _videoRenderer is MediaCodecTrackRenderer
         ? ((MediaCodecTrackRenderer)_videoRenderer).CodecCounters
         : renderers[TypeAudio] is MediaCodecTrackRenderer
             ? ((MediaCodecTrackRenderer)renderers[TypeAudio]).CodecCounters
             : null;
     _bandwidthMeter = bandwidthMeter;
     PushSurface(false);
     _player.Prepare(renderers);
     _rendererBuildingState = RendererBuildingStateBuilt;
 }
Пример #2
0
 /// <summary>
 /// Invoked with the results from a <see cref="IRendererBuilder"/>.
 /// </summary>
 /// <param name="renderers">Renderers indexed by <see cref="VideoPlayer"/>. TYPE_* constants. An individual element may be null if there do not exist tracks of the corresponding type.</param>
 /// <param name="bandwidthMeter">Provides an estimate of the currently available bandwidth. May be null.</param>
 internal void OnRenderers(TrackRenderer[] renderers, IBandwidthMeter bandwidthMeter)
 {
     for (var i = 0; i < RendererCount; i++)
     {
         if (renderers[i] == null)
         {
             // Convert a null renderer to a dummy renderer.
             renderers[i] = new DummyTrackRenderer();
         }
     }
     // Complete preparation.
     _videoRenderer = renderers[TypeVideo];
     _codecCounters = _videoRenderer is MediaCodecTrackRenderer
         ? ((MediaCodecTrackRenderer) _videoRenderer).CodecCounters
         : renderers[TypeAudio] is MediaCodecTrackRenderer
             ? ((MediaCodecTrackRenderer) renderers[TypeAudio]).CodecCounters
             : null;
     _bandwidthMeter = bandwidthMeter;
     PushSurface(false);
     _player.Prepare(renderers);
     _rendererBuildingState = RendererBuildingStateBuilt;
 }