Exoplayer如何知道使用自定义视频视图播放的URL

时间:2018-02-22 06:06:08

标签: video-streaming exoplayer2.x

我第一次使用在线视频播放器,我使用TextureVideoViewMute extends TextureView implements TextureView.SurfaceTextureListener自定义类作为自定义视频播放器。

我的回复urls(主要网址)和source_url中有两个dash_url。现在我想使用ExomediaPlayer,但我有以下问题。< / p>

1.如何播放url的类别?

2.Or这是否会由玩家自己决定?

3.或者我们需要使用单url个玩家自动完成他的工作吗?

4.或者custom video surfaceviewSimpleExoPlayer可能组合吗?

我希望实现的主要内容是adaptive bit rate streaming,如you-tube 144p 220p 720p... etc根据网络状况

我已尝试在GIT上提供示例,但他们正在玩dash_urlsource_url

由于文档很差,我无法理解我应该怎么做。

Exoplayer Sample

  

Exoplayer

的示例代码
  String videoURL = "http://blueappsoftware.in/layout_design_android_blog.mp4";

    SimpleExoPlayerView exoPlayerView = (SimpleExoPlayerView) findViewById(R.id.exo_player_view);
    try {


        BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        TrackSelector trackSelector = new DefaultTrackSelector(new AdaptiveTrackSelection.Factory(bandwidthMeter));
        SimpleExoPlayer exoPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector);

        Uri videoURI = Uri.parse(videoURL);

        DefaultHttpDataSourceFactory dataSourceFactory = new DefaultHttpDataSourceFactory("exoplayer_video");
        ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
        MediaSource mediaSource = new ExtractorMediaSource(videoURI, dataSourceFactory, extractorsFactory, null, null);

        exoPlayerView.setPlayer(exoPlayer);
        exoPlayer.prepare(mediaSource);
        exoPlayer.setPlayWhenReady(true);
    } catch (Exception e) {
        Log.e("MainAcvtivity", " exoplayer error " + e.toString());
    }

0 个答案:

没有答案