gpt4 book ai didi

android - 如何使用 Exoplayer 播放输入流?

转载 作者:太空狗 更新时间:2023-10-29 13:16:15 25 4
gpt4 key购买 nike

我使用以下 FrameWorkSampleSource 构造函数来初始化 SampleSource 实例。

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 作为参数的接口(interface)。

最佳答案

似乎没有简单的方法可以实现这一点,因为 ExoPlayer 不是为此设计的。引用开发者的话:

"We do not provide an implementation that wraps an InputStream directly because the InputStream interface doesn't provide suitable random access behavior for media playback, which is required both for seeking and because some media formats place data at the end of the file that must be read at the start of playback."

在这里阅读他的完整回答:

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

关于android - 如何使用 Exoplayer 播放输入流?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34438055/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com