Exemplo n.º 1
0
            public void OnSingleManifest(Object obj)
            {
                var manifest = obj.JavaCast <HlsPlaylist>();

                if (_canceled)
                {
                    return;
                }

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

                var dataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);

                var chunkSource = new HlsChunkSource(
                    true,
                    dataSource,
                    manifest,
                    DefaultHlsTrackSelector.NewDefaultInstance(_context),
                    bandwidthMeter,
                    timestampAdjusterProvider,
                    HlsChunkSource.AdaptiveModeSplice);

                var sampleSource = new HlsSampleSource(chunkSource
                                                       , loadControl
                                                       , BufferSegments * BufferSegmentSize
                                                       , mainHandler
                                                       , _player
                                                       , MvxVideoPlayer.TypeVideo);
                var videoRenderer = new MediaCodecVideoTrackRenderer(_context
                                                                     , sampleSource
                                                                     , MediaCodecSelector.Default
                                                                     , (int)VideoScalingMode.ScaleToFit
                                                                     , 5000
                                                                     , mainHandler
                                                                     , _player
                                                                     , 50);
                var audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource
                                                                     , MediaCodecSelector.Default
                                                                     , null
                                                                     , true
                                                                     , _player.MainHandler
                                                                     , _player
                                                                     , AudioCapabilities.GetCapabilities(_context)
                                                                     , (int)Stream.Music);
                // TODO: The Id3Parser is currently not part of the binding
                //MetadataTrackRenderer id3Renderer = new MetadataTrackRenderer(sampleSource, new Id3Parser(), player, mainHandler.getLooper());
                var closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, _player,
                                                                    mainHandler.Looper);

                var renderers = new TrackRenderer[MvxVideoPlayer.RendererCount];

                renderers[MvxVideoPlayer.TypeVideo] = videoRenderer;
                renderers[MvxVideoPlayer.TypeAudio] = audioRenderer;
                //renderers[DemoPlayer.TYPE_METADATA] = id3Renderer;
                renderers[MvxVideoPlayer.TypeText] = closedCaptionRenderer;
                _player.OnRenderers(renderers, bandwidthMeter);
            }
        public void BuildRenderers(MvxVideoPlayer player)
        {
            var allocator = new DefaultAllocator(BufferSegmentSize);


            // Build the video and audio renderers.
            var bandwidthMeter = new DefaultBandwidthMeter(player.MainHandler, null);
            var dataSource     = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
            var sampleSource   = new ExtractorSampleSource(_uri, dataSource, allocator,
                                                           BufferSegmentCount * BufferSegmentSize);
            var videoRenderer = new MediaCodecVideoTrackRenderer(_context,
                                                                 sampleSource, MediaCodecSelector.Default, (int)VideoScalingMode.ScaleToFit, 5000, player.MainHandler,
                                                                 player, 50);
            var audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
                                                                 MediaCodecSelector.Default, null, true, player.MainHandler, player, AudioCapabilities.GetCapabilities(_context), (int)Stream.Music);
            var textRenderer = new TextTrackRenderer(sampleSource, player,
                                                     player.MainHandler.Looper);

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

            renderers[MvxVideoPlayer.TypeVideo] = videoRenderer;
            renderers[MvxVideoPlayer.TypeAudio] = audioRenderer;
            renderers[MvxVideoPlayer.TypeText]  = textRenderer;
            player.OnRenderers(renderers, bandwidthMeter);
        }
        public void BuildRenderers(MvxVideoPlayer player)
        {
            var allocator = new DefaultAllocator(BufferSegmentSize);

            // Build the video and audio renderers.
            var bandwidthMeter = new DefaultBandwidthMeter(player.MainHandler, null);
            var dataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
            var sampleSource = new ExtractorSampleSource(_uri, dataSource, allocator,
                BufferSegmentCount*BufferSegmentSize);
            var videoRenderer = new MediaCodecVideoTrackRenderer(_context,
                sampleSource, MediaCodecSelector.Default, (int) VideoScalingMode.ScaleToFit, 5000, player.MainHandler,
                player, 50);
            var audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
                MediaCodecSelector.Default, null, true, player.MainHandler, player, AudioCapabilities.GetCapabilities(_context), (int) Stream.Music);
            var textRenderer = new TextTrackRenderer(sampleSource, player,
                player.MainHandler.Looper);

            // Invoke the callback.
            var renderers = new TrackRenderer[MvxVideoPlayer.RendererCount];
            renderers[MvxVideoPlayer.TypeVideo] = videoRenderer;
            renderers[MvxVideoPlayer.TypeAudio] = audioRenderer;
            renderers[MvxVideoPlayer.TypeText] = textRenderer;
            player.OnRenderers(renderers, bandwidthMeter);
        }