通过ExoPlayer的Android流 [英] Android stream over ExoPlayer

查看:119
本文介绍了通过ExoPlayer的Android流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从MediaPlayer切换为ExoPlayer,但是我找不到任何更新的演示如何使用它.我认为他们已经删除了FrameworkSampleSource方法.我从Github下载了该演示,但找不到播放器的实现,可以在添加URL的Samples对象中找到它. 我有一个要播放的URL列表.我切换到ExoPlayer的原因是它比MediaPlayer更流畅.我已阅读了有关ExoPlayer的所有StackOverflow主题,但这些主题均未更新.

I am trying to switch from MediaPlayer in favor of ExoPlayer but I can't find any updated demo how can I use it.I think they have removed the FrameworkSampleSource method. I downloaded the demo from Github but I can't find the implementation of player, I could find the Samples object where the URLs are added. I have a list of URL's that I want to be played.I am switching to ExoPlayer because it's smoother than MediaPlayer.I have read all StackOverflow topics about ExoPlayer but none of them are updated.

谁能给我一个例子,如何实现呢?谢谢.

Can anyone give me an example how can implement it? Thank you.

推荐答案

    FrameworkSampleSource source = new FrameworkSampleSource(App.getContext(), track.Uri, null, 1);
    TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(source, null, true);
    exoPlayer.prepare(audioRenderer);

希望这个简短的例子会有所帮助

Hope this short example will help

这篇关于通过ExoPlayer的Android流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆