Esempio 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);
            }
Esempio n. 2
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
                    , _url
                    , manifest
                    , DefaultHlsTrackSelector.NewDefaultInstance(_context)
                    , bandwidthMeter
                    , timestampAdjusterProvider
                    , HlsChunkSource.AdaptiveModeSplice);
                var sampleSource = new HlsSampleSource(chunkSource
                    , loadControl
                    , BufferSegments*BufferSegmentSize
                    , mainHandler
                    , _player
                    , VideoPlayer.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[VideoPlayer.RendererCount];
                renderers[VideoPlayer.TypeVideo] = videoRenderer;
                renderers[VideoPlayer.TypeAudio] = audioRenderer;
                //renderers[DemoPlayer.TYPE_METADATA] = id3Renderer;
                renderers[VideoPlayer.TypeText] = closedCaptionRenderer;
                _player.OnRenderers(renderers, bandwidthMeter);
            }