【问题标题】:Exoplayer m3u8 and mp3 run with a single code errorExoplayer m3u8 和 mp3 运行时出现单个代码错误
【发布时间】:2017-11-28 08:10:44
【问题描述】:

如果我使用以下代码中的第一个, 1.m3u8 类型的歌曲正在运行。 如果我使用第二个,mp3 和其他歌曲正在运行。

是否有一个代码系列可以同时运行这些格式?也许这是一个简单的编码,但我做不到。请帮帮我。

 @Override
    protected String doInBackground(String... a) {

        String s = Constant.arrayList_play.get(Constant.playPos).getMp3Url().replace(" ","%20");
        try {


            DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

            DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory((MainActivity)Constant.context,
                    Util.getUserAgent((MainActivity)Constant.context, "onlinemp3"), bandwidthMeter);

            ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();

            MediaSource videoSource = new ExtractorMediaSource(Uri.parse(s),
                    dataSourceFactory, extractorsFactory, null, null);

            Constant.exoPlayer.prepare(videoSource);

            Constant.exoPlayer.setPlayWhenReady(true);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

【问题讨论】:

    标签: android android-music-player exoplayer exoplayer2.x


    【解决方案1】:

    您可能需要阅读here 了解 exoplayer 支持的格式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多