在Swift中可以从mp3文件的特定段访问缓冲区吗?

时间:2019-07-12 07:12:26

标签: ios swift audio buffer audiokit

当我使用AVPlayer在联机mp3文件上寻求特定的timestamp时,它将从该特定的时间戳中拉出缓冲区以进行播放。

我不想下载整个mp3文件,而是要访问音频文件特定段的缓冲区(例如startTime 1:30到endTime 2:00)并将其转换为base64编码的字符串。有办法吗?

//e.g. This should a load a buffer of the audio binary from 10s onwards
// How would I access the buffer of this audio file from lets say 10s - 20s?

let item = AVPlayerItem(Url: "https://audiofile.com/abc.mp3"
let player = AVPlayer(item: item)
player.seek(to: CMTime(seconds: 10, preferredTimeScale:1))

0 个答案:

没有答案