Exoplayer:音频工作但不是视频显示白屏?

时间:2018-01-06 09:27:59

标签: android exoplayer

这是我的Exoplayer代码:
我在Fragment类中使用此代码。我正在从网络流式传输视频,获取视频网址并将uri传递给initializePlayer(uri)方法。

        private void initializePlayer(Uri mediaUri)    {
        if (mExoPlayer == null) {
            TrackSelection.Factory videoTrackSelectionFactory =
                new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);
            TrackSelector trackSelector =
                new DefaultTrackSelector(videoTrackSelectionFactory);

            mExoPlayer = ExoPlayerFactory.newSimpleInstance(getContext(), 
            trackSelector);
            mSimpleExoPlayerView.setPlayer(mExoPlayer);

            DefaultHttpDataSourceFactory dataSourceFactory = new 
            DefaultHttpDataSourceFactory("Baking");
            ExtractorsFactory extractorsFactory = new 
            DefaultExtractorsFactory();

            MediaSource mediaSource = new ExtractorMediaSource(mediaUri, 
            dataSourceFactory, extractorsFactory,
                null, null);

            mExoPlayer.prepare(mediaSource);

         }
      }

0 个答案:

没有答案