vlckit

Playing custom .opus audio file in iOS

被刻印的时光 ゝ 提交于 2020-01-06 05:36:08
问题 I was able to record and play opus using AVFoundation. The problem is I got a custom opus audio file (coming from server, also processed in server) as follows: | header 1 (1 byte) | opus data 1 (1~255 bytes) | header 2 (1 byte) | opus data 2 (1~255 bytes) | ... | ... | Each header indicates size of the opus data i.e. if header 1 is 200 (Int) then opus data 1 is 200 bytes So, I am extracting opus data and appending to Data buffer as following: guard let url = Bundle.main.url(forResource: "test