How can I play PCM data / buffer only with AVAudioPlayer or AVPlayer? I know that I can play PCM data / buffer using AudioUnit / AudioQueue by passing data to the callback method. But I do not want to do this.
I searched a lot on google but couldn't find a useful answer or any sample code for this. Any help would be greatly appreciated.
I answer my question if it helps someone else. After several days of tireless attempts, finally, I succeeded. Although separately. I added the wav header information on top of the RAW PCM data and saved the .wav file. Then just play the file using AVAudioPlayer or AVPlayer. Here you will get a complete code example. How to add a header (e.g. wav, wmv) with PCM data / buffer in iOS NU.
PCM data does not determine the readable format, so AVPlayer will not be able to play it. You must save the PCM data in the audio file format that the player supports.
Source: https://habr.com/ru/post/981727/More articles:What is SQL equivalent to LINQ.All () - sqlusing APITestCase with django-rest-framework - pythonExternal page disappears upon refresh - jQuery mobile - jqueryionic / angular 1.3 - There is no ion-navigation feedback button when the internal menu - angularjsJava thread API: is there syntactic sugar for an identification function? - javaHow to use VFPOLEDB to get DBF information - vb.netHow to map custom HTTP method prefixes on a REST server Delphi DataSnap - restREST Datasnap overrides URI mapping - restHow to get request url at application startup - asp.net-coreASP.NET MVC Authenticate before creating a controller instance - authenticationAll Articles