2015-12-23 54 views
1

我使用以下FrameWorkSampleSource构造函数初始化SampleSource实例。如何使用Exoplayer播放输入流?

File file = new File(path); 
FileInputStream inputStream = new FileInputStream(file); 
FileDescriptor fd = inputStream.getFD(); 
SampleSource sampleSource = new FrameworkSampleSource(fd, 0, file.length()); 

但我需要使用ExoPlayer播放InputStream。我无法找到实现SampleSource类的任何接口,并将InputStream作为其构造函数中的参数。

回答

0

看来,有没有简单的方法来实现这一点,因为ExoPlayer不是为此设计的。引述开发商:

“我们不提供直接包装的InputStream因为InputStream的接口不提供媒体播放,这是双方为寻求和因为一些媒体格式需要适当的随机访问行为的实现将数据放在必须在回放开始时读取的文件末尾。“

这里阅读他的完整的答案:

https://github.com/google/ExoPlayer/issues/1086

+1

我已经通过创建自己的InputStream实现它! https://github.com/amanmj/InputStream_Player –